test(e2e): read the tab strip's dock samples through a typed window field (#24052)

#24010's spec read them with Reflect.get, which the low-evidence lint rejects, so every PR's static analysis now fails on main.
This commit is contained in:
Brennan Benson
2026-09-30 00:45:33 -07:00
committed by GitHub
parent ca7c14db08
commit 7afa4ee3dc
+9 -4
View File
@@ -15,6 +15,13 @@ const STRIP = '.terminal-tab-strip'
type DockSample = { scrollLeft: number; activeLeft: number; activeRight: number }
declare global {
// oxlint-disable-next-line typescript-eslint/consistent-type-definitions -- declaration merging requires interface
interface Window {
__tabStripDockSamples?: DockSample[]
}
}
function slotSelector(tabId: string): string {
return `${STRIP} > [data-tab-strip-slot="${tabId}"]`
}
@@ -120,7 +127,7 @@ test.describe('Tab strip active-tab dock', () => {
requestAnimationFrame(sample)
}
requestAnimationFrame(sample)
Reflect.set(window, '__tabStripDockSamples', samples)
window.__tabStripDockSamples = samples
},
{ strip: STRIP, slot: slotSelector(lastTabId) }
)
@@ -141,9 +148,7 @@ test.describe('Tab strip active-tab dock', () => {
const finalScrollLeft = await strip.evaluate((el) => el.scrollLeft)
expect(finalScrollLeft).toBeGreaterThan(0)
const view = await readSlotViewportSpan(orcaPage, lastTabId)
const samples: DockSample[] = await orcaPage.evaluate(() =>
Reflect.get(window, '__tabStripDockSamples')
)
const samples = await orcaPage.evaluate(() => window.__tabStripDockSamples ?? [])
expect(samples.length).toBeGreaterThan(0)
for (const sample of samples) {
// One jump from the docked position to the reveal; any value in between is visible scrolling.