+
{message}
{detail !== undefined && {detail}}
@@ -254,7 +257,8 @@ export function ErrorBlock({ message, detail, retryLabel, onRetry, busy, classNa
{/* The kit's own action recipe: a retry is a button, not a fifth
spelling of one. */}
- {retryLabel}
+ { if (busy !== true) onRetry(event) }}>{retryLabel}
)}
diff --git a/tests/clues-tab-css.spec.ts b/tests/clues-tab-css.spec.ts
index 3a96b37f..4b9f66f8 100644
--- a/tests/clues-tab-css.spec.ts
+++ b/tests/clues-tab-css.spec.ts
@@ -21,6 +21,7 @@ const controls = read('src/client/ui/controls.module.css')
// The pack shelf's rows are the shared ListRow recipe now, so its density and
// touch-target contract lives in the shared patterns sheet, not in the tab's.
const patterns = read('src/client/ui/patterns.module.css')
+const kit = read('src/client/ui/kit.module.css')
describe('clue tab container-query layout', () => {
it('makes the tab root an inline-size container and never a viewport column', () => {
@@ -63,23 +64,18 @@ describe('clue workbench density and affordances', () => {
})
it('keeps 30px rows and reveals row actions on hover, focus or touch', () => {
- expect(tab).toMatch(/\.resultRow,[\s\S]*?\.pinRow\s*\{[^}]*min-height:\s*30px/)
- // A pack row IS a ListRow: 30px, hover/focus-revealed actions, untouched at rest.
+ // Result, pin and pack rows ARE ListRows: 30px, hover/focus-revealed actions.
expect(patterns).toMatch(/\.listRow\s*\{[^}]*min-height:\s*30px/)
expect(patterns).toMatch(/\.listRowActions\s*\{[^}]*opacity:\s*0/)
expect(patterns).toMatch(/\.listRow:hover \.listRowActions,[\s\S]*?\{\s*opacity:\s*1/)
- const actions = /\.rowActions\s*\{([^}]+)\}/.exec(tab)?.[1]
- expect(actions).toBeDefined()
- expect(actions).toMatch(/opacity:\s*0/)
- expect(tab).toMatch(/\.resultRow:hover \.rowActions,[\s\S]*?\{\s*opacity:\s*1/)
- expect(tab).toMatch(/@media \(hover: none\), \(pointer: coarse\)[\s\S]*\.rowActions\s*\{\s*opacity:\s*1/)
- expect(tab).toMatch(/\.rowActions \.iconButton\s*\{[^}]*width:\s*24px/)
+ expect(patterns).toMatch(/@media \(pointer: coarse\) \{[^}]*\}\s*\.listRowActions \{ opacity: 1; \}/)
+ expect(tab).not.toMatch(/\.(resultRow|pinRow|rowActions)\b/)
})
it('keeps the touch targets from the older scales where the new rows are smaller', () => {
expect(tab).toMatch(/@media[^}]*pointer:\s*coarse/)
expect(tab).toContain('min-height: 44px')
- expect(tab).toMatch(/@media[^}]*pointer:\s*coarse[\s\S]*\.rowActions \.iconButton,[^}]*width:\s*44px/)
+ expect(kit).toMatch(/@media \(pointer: coarse\) \{\s*\.iconButton \{ width: 44px; height: 44px; \}/)
// The ListRow's own coarse-pointer rule: the pack reference button is a
// 44px target through the row, and the row itself grows to 44px.
expect(patterns).toMatch(/@media \(pointer: coarse\) \{\s*\.listRow \{ min-height: 44px; \}/)
diff --git a/tests/theme.spec.ts b/tests/theme.spec.ts
index fb51f488..0662883e 100644
--- a/tests/theme.spec.ts
+++ b/tests/theme.spec.ts
@@ -198,7 +198,8 @@ describe('skin contract: the plugin owns no color of its own', () => {
expect(packRegion).toContain('background: var(--dsw-alias-bg-layer-1)')
expect(source).not.toMatch(/box-shadow/)
expect(source).toMatch(/\.querySubmit\s*\{[^}]*background:\s*transparent/)
- expect(source).toMatch(/\.rowActions \.iconButton\s*\{[^}]*color:\s*var\(--dsw-alias-label-tertiary\)/)
+ const patterns = readFileSync(resolve(ROOT, 'src/client/ui/patterns.module.css'), 'utf8')
+ expect(patterns).toMatch(/\.listRowActions > button\s*\{[^}]*color:\s*var\(--dsw-alias-label-tertiary\)/)
})
it('source identity remains themed while actions use the single shared recipe', () => {
diff --git a/tests/ui-patterns.spec.tsx b/tests/ui-patterns.spec.tsx
index af97a4a7..504f0fa2 100644
--- a/tests/ui-patterns.spec.tsx
+++ b/tests/ui-patterns.spec.tsx
@@ -173,13 +173,17 @@ describe('ErrorBlock', () => {
expect(view.container.querySelector('button')).toBeNull()
})
- it('locks the retry while one is in flight instead of offering a second', () => {
+ it('locks the retry while one is in flight without dropping its focus', () => {
+ const onRetry = vi.fn()
view = renderRoot(createElement(ErrorBlock, {
- message: 'Request failed', retryLabel: 'Retry', onRetry: () => {}, busy: true,
+ message: 'Request failed', retryLabel: 'Retry', onRetry, busy: true,
}))
const retry = view.container.querySelector('button')!
- expect(retry.disabled).toBe(true)
- expect(retry.getAttribute('aria-busy')).toBe('true')
+ expect(retry.disabled).toBe(false)
+ expect(retry.getAttribute('aria-disabled')).toBe('true')
+ expect(view.container.querySelector('[role="alert"]')!.getAttribute('aria-busy')).toBe('true')
+ retry.click()
+ expect(onRetry).not.toHaveBeenCalled()
})
it('separates a sanitized detail from the message', () => {