Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/e2e/editor-baseline-1377.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ function tabHit(pane: Locator, file: string): Locator {
}

function tabFor(pane: Locator, file: string): Locator {
return pane.locator(EDITOR_SELECTORS.tab).filter({ hasText: file });
// The dirty/active state lives on the outer `.ed-tab` span that wraps the file's `.ed-tab-hit`.
return pane.locator(
`${EDITOR_SELECTORS.tab}:has(${EDITOR_SELECTORS.tabHit}[data-tip="${file}"])`,
);
}

function closeButton(pane: Locator, file: string): Locator {
Expand Down Expand Up @@ -263,7 +266,8 @@ async function scenarioAccessibility(page: Page): Promise<void> {
await expect(workspace.locator(EDITOR_SELECTORS.tablist)).toHaveCount(1);
await expect(pane.getByRole("tab", { name: APP_FILE })).toBeVisible();

// Alt+Arrow switches the active tab from the keyboard while focus stays within the tablist.
// Alt+ArrowRight reorders the active tab within the tablist via the keyboard; focus stays on a
// tab so a keyboard user does not lose their place.
const appTab = tabHit(pane, APP_FILE);
await appTab.focus();
await appTab.press("Alt+ArrowRight");
Expand Down Expand Up @@ -293,6 +297,8 @@ async function scenarioAccessibility(page: Page): Promise<void> {
await closeButton(pane, APP_FILE).click();
const dialog = workspace.locator(EDITOR_SELECTORS.dirtyDialog);
await expect(dialog).toBeVisible();
// The modal labels itself via its heading, takes focus on open, and Escape dismisses it.
await expect(dialog).toHaveAttribute("aria-labelledby", EDITOR_SELECTORS.dirtyDialogTitleId);
await expect(dialog).toBeFocused();
await page.keyboard.press("Escape");
await expect(dialog).toBeHidden();
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/support/editorWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export const EDITOR_SELECTORS = {
sidebarRestore: ".ed-sidebar-restore[aria-label='Show project tree']",
treeRow: "button.tr-row",
tablist: ".ed-tablist[role='tablist'][aria-label='Open documents']",
tab: ".ed-tab[role='tab']",
// The outer tab element carries the `active`/`data-dirty` state; `role='tab'` and the
// `data-tip`/`aria-selected` affordances live on the inner `.ed-tab-hit` button it wraps.
tab: ".ed-tab",
tabHit: ".ed-tab-hit",
tabLabel: ".ed-tab-label",
tabClose: ".ed-tab-close",
Expand Down
Loading