fix(webui): settings-s5b recheck: after an empty history page, folding the list keeps Show older, since the line still names it (N1); a test holds that a successful Read again moves focus to Show older (N2); tests red on 3b17326b7 (#1873, lane settings-s5b)

This commit was merged in pull request #2008.
This commit is contained in:
jason.woltje committed 2026-11-19 23:30:29 -06:00
1 parent 3b17326b74
commit de39750ebb
2 files changed
+14 -3

No files matched your search

+3 -2
View File
@@ -1080,10 +1080,11 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
}));
const more = hist.next !== null;
// Show all only when some entries are folded away; Show older whenever there is an older page and
// nothing read is folded away, so an empty page offers it at once.
// nothing read is folded away, so an empty page offers it at once. After an empty page it stays while
// the list is folded, since the line below names it.
all.hidden = !hist.read || hist.entries.length <= FEW;
all.textContent = hist.expanded ? 'Show fewer' : 'Show all'; all.setAttribute('aria-expanded', String(hist.expanded));
older.hidden = !more || Boolean(hist.error) || (!hist.expanded && hist.entries.length > FEW);
older.hidden = !more || Boolean(hist.error) || (!hist.expanded && hist.entries.length > FEW && !hist.emptyPage);
older.disabled = hist.loading; older.textContent = hist.loading ? 'Reading…' : 'Show older';
retry.hidden = !hist.error;
msg.className = hist.error ? 'banner err' : 'small muted';
@@ -278,6 +278,12 @@ test('settings-s5b: history pages back one page at a time, shows each entry once
assert.equal(await b.evaluate('document.querySelectorAll("#proxy-setup-history li").length'), 4);
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-history-older").hidden'), false);
assert.equal(await b.evaluate('document.activeElement?.id'), 'proxy-setup-history-older');
// Folding the list keeps Show older, because the line above still names it.
await click('#proxy-setup-history-all');
assert.equal(await text('#proxy-setup-history-all'), 'Show all');
assert.equal(await text('#proxy-setup-history-message'), 'That page of history had no entries to show. Show older reads further back.');
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-history-older").hidden'), false);
await click('#proxy-setup-history-all');
await click('#proxy-setup-history-older');
await wait('document.querySelectorAll("#proxy-setup-history li").length === 5');
const list = await items(b);
@@ -328,7 +334,7 @@ test('settings-s5b: a short first page offers Show older at once, and what it re
});
test('settings-s5b: an older page that is not further back than the one asked for is not shown', { timeout: 90000 }, async t => {
const { b, wait, text, click } = await setup(t, { admin: { ...OK, 'history?limit=25&before=3': { entries: [{ op: 'init', time: T(2), user: 'jason' }], next: 3 } } });
const { b, wait, text, click } = await setup(t, { admin: { ...OK, 'history?limit=25&before=3': [{ entries: [{ op: 'init', time: T(2), user: 'jason' }], next: 3 }, PAGE2] } });
await wait(READY); await openTech(b);
await wait('document.querySelectorAll("#proxy-setup-history li").length === 4');
await click('#proxy-setup-history-all');
@@ -338,6 +344,10 @@ test('settings-s5b: an older page that is not further back than the one asked fo
assert.equal(await b.evaluate('document.querySelectorAll("#proxy-setup-history li").length'), 4, 'the repeated page adds nothing');
// The pressed button went away, so focus lands on Read again.
assert.equal(await b.evaluate('document.activeElement?.id'), 'proxy-setup-history-retry');
// Read again answers; it goes away, and focus lands on Show older, not Show fewer.
await b.evaluate('document.querySelector("#proxy-setup-history-retry").click(); true');
await wait('document.querySelector("#proxy-setup-history-retry").hidden && /no entries to show/.test(document.querySelector("#proxy-setup-history-message").textContent)');
assert.equal(await b.evaluate('document.activeElement?.id'), 'proxy-setup-history-older');
});
test('settings-s5b: a history answer from before Technical details was closed and opened again is dropped', { timeout: 90000 }, async t => {