Mache die Breite der Ablage ziehbar und merkbar, verdichte die Zeilen und löse Vorgänge aus einer Akte, ohne sie zu löschen.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f60e1fe40
commit
7b2d0c298e
8 files changed
+201
-7
No files matched your search
@@ -127,3 +127,30 @@ test("the outline signature changes with chapters, subcases and matters", () =>
|
||||
assert.notEqual(outlineSignature({ ...base, matters: [] }), same);
|
||||
assert.equal(outlineSignature(null), "");
|
||||
});
|
||||
|
||||
import { TREE_DEFAULT, TREE_MAX, TREE_MIN, clampTreeWidth, readTreeWidth, writeTreeWidth } from "./library-core.js";
|
||||
|
||||
function memory(initial = {}) {
|
||||
const data = { ...initial };
|
||||
return { getItem: (key) => (key in data ? data[key] : null), setItem: (key, value) => { data[key] = value; }, data };
|
||||
}
|
||||
|
||||
test("the tree width stays within its limits and falls back to the default", () => {
|
||||
assert.equal(clampTreeWidth(10), TREE_MIN);
|
||||
assert.equal(clampTreeWidth(9999), TREE_MAX);
|
||||
assert.equal(clampTreeWidth(300.4), 300);
|
||||
assert.equal(clampTreeWidth("abc"), TREE_DEFAULT);
|
||||
assert.equal(clampTreeWidth(undefined), TREE_DEFAULT);
|
||||
});
|
||||
|
||||
test("the tree width is remembered and a broken store does not matter", () => {
|
||||
const store = memory();
|
||||
assert.equal(readTreeWidth(store), TREE_DEFAULT);
|
||||
assert.equal(writeTreeWidth(380, store), 380);
|
||||
assert.equal(readTreeWidth(store), 380);
|
||||
assert.equal(readTreeWidth(memory({ "tsumugu-tree-width": "99999" })), TREE_MAX);
|
||||
const broken = { getItem() { throw new Error("blocked"); }, setItem() { throw new Error("blocked"); } };
|
||||
assert.equal(readTreeWidth(broken), TREE_DEFAULT);
|
||||
assert.equal(writeTreeWidth(300, broken), 300);
|
||||
assert.equal(readTreeWidth(null), TREE_DEFAULT);
|
||||
});
|
||||
Reference in new issue
Block a user