refactor(storybook): fold SW Header Options stories into SW/Header
Remove the separate SW/Header/Options sidebar item. Its examples move to two
Stories directly under SW/Header (src/sw/sw-header-open.stories.tsx):
- Document Open: Open placement, label, 10-width responsive, composed bar,
composed (controls) responsive
- Hidden Sub Controls: document New / Open and layer freeze / lock removal
No public API or component change. Tests and inventory follow the new IDs
(integrated 97/97, existing Stories pixel-identical 28/28, unused-removal
83/83). The two remaining overview failures are pre-existing historical
assertions (also failing on 5faa1f1), not new defects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55179b4577
commit
e8409eff44
17 files changed
+168
-87
No files matched your search
@@ -33,7 +33,7 @@ const log = () => page.locator('[data-callback-log]').first().textContent()
|
||||
const rect = locator => locator.evaluate(e => { const r = e.getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height, right: r.right } })
|
||||
|
||||
if (sections.includes('options')) {
|
||||
await goto('sw-header-options--open-placement')
|
||||
await goto('sw-header--document-open')
|
||||
const frames = page.locator('.sw-story-frame')
|
||||
// Default placement unchanged: no header Open, dropdown footer keeps + New / Open.
|
||||
const plain = frames.nth(0).locator('header.hm-sw-header')
|
||||
@@ -63,7 +63,7 @@ if (sections.includes('options')) {
|
||||
await page.keyboard.press('Escape')
|
||||
await open.click()
|
||||
check('header: Open calls onDocumentOpen', (await log()).includes('onDocumentOpen'))
|
||||
check('documentOpenLabel is the Open text', await frames.nth(2).locator('[data-document-open]').textContent() === '파일 열기')
|
||||
check('documentOpenLabel is the Open text', await page.locator('[data-open-label] [data-document-open]').textContent() === '파일 열기')
|
||||
|
||||
// Responsive: measured room. No overflow anywhere; Open is either shown or reachable in More.
|
||||
const widths = []
|
||||
@@ -106,7 +106,7 @@ if (sections.includes('options')) {
|
||||
const flips = trace.slice(1).filter((step, index) => step[1] !== trace[index][1]).length
|
||||
check('resize: collapsed Open returns once when the header grows (measured, with hysteresis)', trace[0][1] === 0 && trace.at(-1)[1] === 1 && flips === 1, trace)
|
||||
|
||||
await goto('sw-header-options--hidden-sub-controls')
|
||||
await goto('sw-header--hidden-sub-controls')
|
||||
const onlyOpen = page.locator('[data-hidden="new"] .hm-sw-header__document-footer')
|
||||
const footer = await rect(onlyOpen), action = await rect(onlyOpen.locator('.hm-sw-header__document-action'))
|
||||
check('hidden documentNew: footer keeps Open on its right side', JSON.stringify(await onlyOpen.locator('.hm-sw-header__document-action').allTextContents()) === '["Open"]' && Math.abs(footer.right - 8 - action.right) < 1, { footer, action })
|
||||
@@ -121,7 +121,7 @@ if (sections.includes('options')) {
|
||||
await page.locator('[data-hidden="layer-states"]').screenshot({ path: path.join(out, 'hidden-layer-states.png') })
|
||||
await page.locator('[data-hidden="new"]').screenshot({ path: path.join(out, 'hidden-document-new.png') })
|
||||
|
||||
await goto('sw-header-options--composed-open')
|
||||
await goto('sw-header--document-open')
|
||||
const bar = page.locator('[data-composed-open]')
|
||||
const cHome = await rect(bar.locator('.hm-sw-header__home')), cOpen = await rect(bar.locator('.hm-sw-header__document[data-tool] button')), cDoc = bar.locator('.hm-sw-header__document:not([data-tool]) .hm-sw-header__document-button')
|
||||
check('composed: Open right of the logo at the same junction offset as SWHeader', Math.abs(cOpen.x - cHome.right - report.data.junction) < 0.6 && cOpen.h === 48, { cHome, cOpen })
|
||||
@@ -135,7 +135,7 @@ if (sections.includes('options')) {
|
||||
}
|
||||
|
||||
if (sections.includes('options') || sections.includes('composed')) {
|
||||
await goto('sw-header-options--composed-responsive')
|
||||
await goto('sw-header--document-open')
|
||||
const rows = []
|
||||
for (const item of await page.locator('[data-composed-responsive] > [data-width]').all()) {
|
||||
const width = Number(await item.getAttribute('data-width'))
|
||||
|
||||
Reference in new issue
Block a user