mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 10:24:05 +00:00
test: bring the packing, todo and dashboard changes in line with the CI gates
Lower the lint and strict baselines the redesign made smaller, keep the detail window and the todo tab under the complexity limit by moving their choices into helpers, read the toast in the detail test through its module rather than a window global, keep the new dialog focus case in the module's existing test file, show the panel's progress once in the standalone header, and point the planner wiring tests at the Lists menu.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// FE-SHARED-DIALOGFOCUS-001 to FE-SHARED-DIALOGFOCUS-009
|
||||
// FE-SHARED-DIALOGFOCUS-001 to FE-SHARED-DIALOGFOCUS-010
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { useState } from 'react'
|
||||
import { render, screen, fireEvent } from '../../../tests/helpers/render'
|
||||
import { DialogShell } from './DialogShell'
|
||||
import Modal from './Modal'
|
||||
import { firstTextField } from './dialogFocus'
|
||||
import { firstTextField, focusDialog } from './dialogFocus'
|
||||
|
||||
/** A desktop with a mouse: the only case the first field takes the focus. */
|
||||
function asDesktop() {
|
||||
@@ -138,4 +138,18 @@ describe('Modal focus (#1302)', () => {
|
||||
fireEvent.keyDown(save, { key: 'Tab' })
|
||||
expect(screen.getByRole('button', { name: 'Close' })).toHaveFocus()
|
||||
})
|
||||
|
||||
it('FE-SHARED-DIALOGFOCUS-010: a field marked as the start wins over the first one, a focus inside stays', () => {
|
||||
restore = asDesktop()
|
||||
const panel = document.createElement('div')
|
||||
panel.tabIndex = -1
|
||||
panel.innerHTML = '<input id="first" type="text"><input id="start" type="text" data-initial-focus>'
|
||||
document.body.appendChild(panel)
|
||||
focusDialog(panel)
|
||||
expect(document.activeElement?.id).toBe('start')
|
||||
;(panel.querySelector('#first') as HTMLElement).focus()
|
||||
focusDialog(panel)
|
||||
expect(document.activeElement?.id).toBe('first')
|
||||
panel.remove()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user