fix(jobs): stop naming the job list after its section
The section's heading already names the region, so assistive technology read "Background jobs" three times in a row.
This commit is contained in:
1 parent
81feedf2d7
commit
9acb1bc2dd
9 files changed
+16
-14
No files matched your search
@@ -87,7 +87,7 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
|
||||
onTestFailed(() => saveFailureShot(page, `web-e2e-background-job-${phase}`))
|
||||
const toggle = sessionPanelToggle(page)
|
||||
const section = (await showSessionPanel(page)).locator(SECTION)
|
||||
const list = section.getByRole('list', { name: 'Background jobs' })
|
||||
const list = section.getByRole('list')
|
||||
// The mounted section keeps the roster stream open but renders no rows
|
||||
// yet, so the panel hides it with its title. A one-shot check: polling for
|
||||
// zero would pass at t=0 before delivery and prove nothing.
|
||||
@@ -204,7 +204,7 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
|
||||
expect(await original.evaluate(element => element.isConnected && element === document.activeElement)).toBe(true)
|
||||
const panel = await showSessionPanel(page)
|
||||
expect(await panel.getAttribute('data-session-panel')).toBe('overlay')
|
||||
const list = panel.locator(SECTION).getByRole('list', { name: 'Background jobs' })
|
||||
const list = panel.locator(SECTION).getByRole('list')
|
||||
await list.getByRole('button', { name: 'Finished 1', exact: true }).waitFor()
|
||||
// The long command truncates inside its row instead of widening the panel past the viewport.
|
||||
const fit = await panel.evaluate((element) => {
|
||||
|
||||
@@ -149,7 +149,7 @@ describe.skipIf(MODE === 'record')('web e2e: jobs panel layering', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
await panel.waitFor()
|
||||
const list = panel.getByRole('list', { name: 'Background jobs' })
|
||||
const list = panel.locator('[data-session-panel-section="background-jobs"]').getByRole('list')
|
||||
await list.getByRole('button', { name: /Show live output/ }).waitFor({ timeout: 15_000 })
|
||||
const expectedPlacement = {
|
||||
dockMode: 'push', presentation: 'overlay', insideBody: true, clearOfBrowser: true,
|
||||
|
||||
@@ -86,7 +86,7 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
|
||||
it('streams a running job\'s real output into the expanded row, then settles it in place on kill', async () => {
|
||||
let phase = 'streaming'
|
||||
onTestFailed(() => saveFailureShot(page, `web-e2e-live-job-${phase}`))
|
||||
const list = page.locator(SECTION).getByRole('list', { name: 'Background jobs' })
|
||||
const list = page.locator(SECTION).getByRole('list')
|
||||
await showSessionPanel(page)
|
||||
expect(await list.count()).toBe(0)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- list:
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- list:
|
||||
- listitem:
|
||||
- button "Hide live output of printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done" [expanded]: printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done bash · running {{duration}}
|
||||
- button "Stop task printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done"
|
||||
|
||||
@@ -414,7 +414,8 @@ export function JobsSection({ sessionId, useJobs, watchRows, observe, killJob, u
|
||||
)
|
||||
|
||||
return (
|
||||
<ul className={css.list} aria-label={t('list.aria')} data-jobs-section="">
|
||||
// The section's heading names the region; a list name would repeat it.
|
||||
<ul className={css.list} data-jobs-section="">
|
||||
{liveRows.map(item)}
|
||||
{settledRows.length > 0
|
||||
? (
|
||||
|
||||
@@ -145,7 +145,8 @@ describe('JobsSection rows', () => {
|
||||
render(<JobsSection {...props([
|
||||
job({ id: 'subagent-1' as JobView['id'], kind: 'subagent', label: 'explore the repo', status: 'completed', finishedAt: 1_700_000_003_000 }),
|
||||
])} />)
|
||||
expect(screen.getByRole('list', { name: zh['list.aria'] })).toBeDefined()
|
||||
// The section heading names the region, so the list carries no name of its own.
|
||||
expect(screen.getByRole('list').hasAttribute('aria-label')).toBe(false)
|
||||
expect(screen.getByText('explore the repo')).toBeDefined()
|
||||
expect(screen.queryByRole('button', { name: zh['row.expandAria'].replace('{label}', 'explore the repo') })).toBeNull()
|
||||
})
|
||||
@@ -159,7 +160,7 @@ describe('JobsSection rows', () => {
|
||||
it('shows the live progress line in place of the status word', () => {
|
||||
render(<JobsSection {...props([job({ status: 'stopping', progress: 'winding down' })])} />)
|
||||
openList()
|
||||
const list = screen.getByRole('list', { name: zh['list.aria'] })
|
||||
const list = screen.getByRole('list')
|
||||
expect(within(list).getByText('pnpm run build')).toBeDefined()
|
||||
expect(within(list).getByText('bash · winding down')).toBeDefined()
|
||||
})
|
||||
@@ -241,7 +242,7 @@ describe('JobsSection rows', () => {
|
||||
])} />)
|
||||
openList()
|
||||
fireEvent.click(screen.getByRole('button', { name: zh['section.settledCount'].replace('{count}', '1') }))
|
||||
const list = screen.getByRole('list', { name: zh['list.aria'] })
|
||||
const list = screen.getByRole('list')
|
||||
const items = within(list).getAllByRole('listitem')
|
||||
// The section line is a listitem too now: live row, section, settled row.
|
||||
expect(items).toHaveLength(3)
|
||||
@@ -272,7 +273,7 @@ describe('JobsSection rows', () => {
|
||||
])} />)
|
||||
openList()
|
||||
fireEvent.click(screen.getByRole('button', { name: zh['section.settledCount'].replace('{count}', '5') }))
|
||||
const labels = within(screen.getByRole('list', { name: zh['list.aria'] }))
|
||||
const labels = within(screen.getByRole('list'))
|
||||
.getAllByRole('listitem')
|
||||
.map(item => item.querySelector('[data-job-label]')?.textContent)
|
||||
.filter((label): label is string => label != null)
|
||||
@@ -403,7 +404,7 @@ describe('JobsSection observation', () => {
|
||||
render(<JobsSection {...props([job()], undefined, { 'bash-1': view })} />)
|
||||
openList()
|
||||
fireEvent.click(screen.getByRole('button', { name: zh['row.expandAria'].replace('{label}', 'pnpm run build') }))
|
||||
expect(screen.getByRole('list', { name: zh['list.aria'] }).querySelector('[data-running]')).not.toBeNull()
|
||||
expect(screen.getByRole('list').querySelector('[data-running]')).not.toBeNull()
|
||||
expect(screen.queryByText(zh['terminal.noOutput'])).toBeNull()
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- list:
|
||||
- listitem:
|
||||
- button "Show live output of for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done": for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done bash · running {{duration}}
|
||||
- button "Stop task for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done"
|
||||
@@ -1,6 +1,6 @@
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- list:
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
|
||||
Reference in new issue
Block a user