Skip to content

Commit d0a9cea

Browse files
Prithvi-Webclaude
andcommitted
test(picker): the focus-guard test runs the page's own inModalOverlay beside the guard it lifts, and pins that focus in the score breakdown a sheet opened over it stays (merge of BQA-1 onto frv-d)
folderPicker's F1.10 test (frv-d) lifts the page's focusin guard and runs it with stand-ins. Since BQA-1's B31 merged, the guard also lets focus stay in a panel a sheet's own content opens over it — `!inModalOverlay(...)` beside frv-d's #toasts exemption, the one condition the BQA-1 merge made of both — and the test failed with "inModalOverlay is not defined" (found by the coordinator's full-suite run on REL-55). The test now lifts the page's own MODAL_OVERLAYS and inModalOverlay from the built page, as it lifts the guard, rather than a stand-in that agrees with itself, and asks one more thing of the merged guard: focus in the score breakdown (#rcPopover) a sheet opened over it is not pulled back. folderPicker 40/40. 3 hand mutants of the page's inModalOverlay, each RED and restored by SHA-256: answering true ("control: focus that lands on the page under a sheet is pulled back into it"), answering false and an empty MODAL_OVERLAYS ("focus in the score breakdown a sheet opened over it stays there (B31)"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1aee927 commit d0a9cea

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎tests/folderPicker.test.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,12 @@ test('an offer takes focus, so a keyboard reaches it with a sheet open or not, a
12591259
const guardAt = INDEX.indexOf("document.addEventListener('focusin', (e) => {\n noteFocus(e.target);");
12601260
assert.notEqual(guardAt, -1, 'the page has its focusin guard');
12611261
const guard = INDEX.slice(guardAt, INDEX.indexOf('\n});', guardAt) + '\n});'.length);
1262+
// The guard also lets focus stay in a panel a sheet's own content opens over it (inModalOverlay,
1263+
// BQA-1 B31): the page's own list and test, lifted as the guard is, never a stand-in that agrees with itself.
1264+
const overlayAt = INDEX.indexOf('const MODAL_OVERLAYS = ');
1265+
assert.notEqual(overlayAt, -1, 'the page lists the panels a sheet opens over it');
1266+
const overlayFnAt = INDEX.indexOf('function inModalOverlay(', overlayAt);
1267+
const overlay = INDEX.slice(overlayAt, INDEX.indexOf('\n}\n', overlayFnAt) + '\n}\n'.length);
12621268
const inSheet = { id: 'save' };
12631269
const inToast = { id: 'offer' };
12641270
const onPage = { id: 'map' };
@@ -1267,7 +1273,7 @@ test('an offer takes focus, so a keyboard reaches it with a sheet open or not, a
12671273
const pulled: unknown[] = [];
12681274
const heard: { focusin?: (e: { target: unknown }) => void } = {};
12691275
// eslint-disable-next-line @typescript-eslint/no-implied-eval
1270-
new Function('document', '$', 'noteFocus', 'topModal', 'modalFocusInto', `'use strict'; ${guard}`)(
1276+
new Function('document', '$', 'noteFocus', 'topModal', 'modalFocusInto', `'use strict'; ${overlay}\n${guard}`)(
12711277
{ addEventListener: (t: string, f: (e: { target: unknown }) => void) => { if (t === 'focusin') heard.focusin = f; } },
12721278
(id: string) => { assert.equal(id, 'toasts'); return toasts; },
12731279
() => {}, () => sheet, (s: unknown) => { pulled.push(s); });
@@ -1276,6 +1282,9 @@ test('an offer takes focus, so a keyboard reaches it with a sheet open or not, a
12761282
assert.deepEqual(pulled, [sheet], 'control: focus that lands on the page under a sheet is pulled back into it');
12771283
heard.focusin!({ target: inToast });
12781284
assert.deepEqual(pulled, [sheet], 'focus on an offer\'s button stays there');
1285+
const inBreakdown = { id: 'rcPopClose', closest: (sel: string) => (sel === '#rcPopover' ? {} : null) };
1286+
heard.focusin!({ target: inBreakdown });
1287+
assert.deepEqual(pulled, [sheet], 'focus in the score breakdown a sheet opened over it stays there (B31)');
12791288
});
12801289

12811290
test('an offer made in a sheet goes when that sheet closes — its choice with it, even while it holds focus — the other offers stay, and each offer names the sheet it was made in (final review F2.2, F2.3)', async () => {

0 commit comments

Comments
 (0)