test(sw): cover roving focus wrap and outside pointer dismissal
keyboard-dismiss.browser.mjs + fixtures/tool-group.tsx: end-point wrap, Home / End, disabled items and a pointerdown outside that does not move focus, for the callers of the shared helpers (22 checks; same result before the refactor).
This commit is contained in:
1 parent
7cc3aa1ff8
commit
0f9e9b0e4c
2 files changed
+138
No files matched your search
+21
@@ -0,0 +1,21 @@
|
||||
// Test-only host for keyboard-dismiss.browser.mjs (2026-10-20): SWToolGroup selection="single" has no current Story
|
||||
// (SW/Tool was removed in 7f42923). Public @hm-design/sw API only; the host owns the pressed option.
|
||||
import { useState } from "react"
|
||||
import { createRoot } from "react-dom/client"
|
||||
import { SWTheme, SWToolButton, SWToolGroup } from "@hm-design/sw"
|
||||
import "@hm-design/sw/styles.css"
|
||||
|
||||
const OPTIONS = [{ id: "a", label: "모델" }, { id: "b", label: "배치" }, { id: "c", label: "단면", disabled: true }, { id: "d", label: "상세" }]
|
||||
|
||||
function Host() {
|
||||
const [selected, setSelected] = useState("b")
|
||||
return (
|
||||
<SWTheme data-tool-fixture="" data-selected={selected}>
|
||||
<SWToolGroup label="보기" selection="single">
|
||||
{OPTIONS.map(option => <SWToolButton key={option.id} data-option={option.id} pressed={selected === option.id} disabled={option.disabled} onClick={() => setSelected(option.id)}>{option.label}</SWToolButton>)}
|
||||
</SWToolGroup>
|
||||
</SWTheme>
|
||||
)
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Host />)
|
||||
Reference in new issue
Block a user