web: name a roll's folders before reading their frames
This commit is contained in:
@@ -154,7 +154,12 @@ await context.addInitScript(
|
||||
names: [JPG],
|
||||
// One frame at the top, one a folder down, one two folders down: the walk has
|
||||
// to reach the bottom of the roll, not just its first level.
|
||||
subs: { 2026: { files: [RAW], dirs: { '04': { files: [JPG], dirs: {} } } } },
|
||||
// One folder down, one two deep, and one holding no frame the catalogue can
|
||||
// read: the walk names it long before there is a thumbnail for it.
|
||||
subs: {
|
||||
2026: { files: [RAW], dirs: { '04': { files: [JPG], dirs: {} } } },
|
||||
Empty: { files: ['notes.txt'], dirs: {} },
|
||||
},
|
||||
folder: 'CheckRoll',
|
||||
}
|
||||
);
|
||||
@@ -225,6 +230,8 @@ step(
|
||||
['lib-node-CheckRoll', '3'],
|
||||
['lib-node-CheckRoll/2026', '2'],
|
||||
['lib-node-CheckRoll/2026/04', '1'],
|
||||
// Named by the walk, counted by nothing: a row before a frame.
|
||||
['lib-node-CheckRoll/Empty', '0'],
|
||||
]),
|
||||
JSON.stringify(nodes)
|
||||
);
|
||||
@@ -245,11 +252,11 @@ step(
|
||||
`${foldedThumbs} tiles, aria-expanded=${shut}, stage ${foldedMeta.split('\n')[0]}`
|
||||
);
|
||||
await page.click('[data-key="lib-node-CheckRoll"]');
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-key^="lib-node-"]').length === 3, null, {
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-key^="lib-node-"]').length === 4, null, {
|
||||
timeout: 10_000,
|
||||
polling: 50,
|
||||
});
|
||||
step('the same click draws it open again', true, '3 rows');
|
||||
step('the same click draws it open again', true, '4 rows');
|
||||
|
||||
// Show subfolders or not: the strip follows the open folder alone, or the whole
|
||||
// branch under it. The switch is the reader's and the tree does not change with
|
||||
@@ -260,13 +267,40 @@ const shallow = await page.$$eval('[data-key^="lib-node-"]', (els) => els.length
|
||||
const shallowStage = await page.locator('[data-key="lib-stage-meta"]').innerText();
|
||||
step(
|
||||
'the switch leaves the open folder its own frames',
|
||||
shallow === 3 && /P1010256\.JPG/.test(shallowStage),
|
||||
shallow === 4 && /P1010256\.JPG/.test(shallowStage),
|
||||
`${shallow} rows, stage ${shallowStage.split('\n')[0]}`
|
||||
);
|
||||
await page.click('[data-key="lib-subs"]');
|
||||
await page.waitForFunction((sel) => document.querySelectorAll(sel).length === 3, thumbs, { timeout: 10_000, polling: 50 });
|
||||
step('and puts the branch back', true, '3 tiles from the roll below');
|
||||
|
||||
// A folder the walk named and the catalogue found nothing in: the row is there,
|
||||
// the strip says so rather than drawing nothing at all.
|
||||
await page.click('[data-key="lib-node-CheckRoll/Empty"]');
|
||||
await page.waitForFunction(() => document.querySelector('.adm-filmstrip .adm-row-empty') !== null, null, {
|
||||
timeout: 10_000,
|
||||
polling: 50,
|
||||
});
|
||||
const emptyThumbs = await page.$$eval(thumbs, (els) => els.length);
|
||||
const emptyHint = await page.$eval('.adm-filmstrip .adm-row-empty', (e) => e.textContent);
|
||||
step(
|
||||
'a folder the walk named but holds no frame draws an empty strip',
|
||||
emptyThumbs === 0 && /chưa có ảnh|nothing in this folder/i.test(emptyHint ?? ''),
|
||||
`${emptyThumbs} tiles, "${emptyHint}"`
|
||||
);
|
||||
// Back to the roll: the first click folds it on the way, so it takes two.
|
||||
await page.click('[data-key="lib-node-CheckRoll"]');
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-key^="lib-node-"]').length === 1, null, {
|
||||
timeout: 10_000,
|
||||
polling: 50,
|
||||
});
|
||||
await page.click('[data-key="lib-node-CheckRoll"]');
|
||||
await page.waitForFunction((sel) => document.querySelectorAll(sel).length === 3, thumbs, {
|
||||
timeout: 10_000,
|
||||
polling: 50,
|
||||
});
|
||||
step('and the roll comes back with its frames', true, '3 tiles');
|
||||
|
||||
// Opening the subfolder redraws the strip and the frame above it.
|
||||
await page.click('[data-key="lib-node-CheckRoll/2026"]');
|
||||
await page.waitForFunction((sel) => document.querySelectorAll(sel).length === 2, thumbs, { timeout: 30_000 });
|
||||
|
||||
Reference in New Issue
Block a user