Compare commits

...

3 Commits

Author SHA1 Message Date
jaybe 28f9548f16 Export A11y 회귀 매트릭스: input/select/textarea label/for·describedby, radio/checkbox fieldset·legend·help 검증 추가
Auto PR / open-pr (push) Successful in 19s
Auto Label PR / add-automerge-label (pull_request) Successful in 7s
CI / test (pull_request) Failing after 1m5s
2025-11-17 19:45:31 +09:00
jaybe f7fa433bdd 문서: MAIN_PLAN 최신 배치 기록 추가(마퀴 수정, 그룹 드래그/리사이즈·회전 E2E, 이미지 옵션 2차, CSS 토큰 딥 회귀) 2025-11-17 19:26:32 +09:00
jaybe 8f51494433 E2E 스모크 확장: 그룹 리사이즈(E)/회전(15° 스냅) + 라이브리전 가이드 포함 검증 추가
Auto PR / open-pr (push) Successful in 27s
Auto Label PR / add-automerge-label (pull_request) Successful in 6s
CI / test (pull_request) Failing after 1m14s
2025-11-17 19:08:06 +09:00
5 changed files with 265 additions and 0 deletions
+30
View File
@@ -248,6 +248,36 @@
- 이동하지 않은 축은 기존 좌표 유지하여 비의도 축 보정 방지 - 이동하지 않은 축은 기존 좌표 유지하여 비의도 축 보정 방지
- 결과: 전체 테스트 그린(168 파일 / 295 테스트) - 결과: 전체 테스트 그린(168 파일 / 295 테스트)
### CI E2E 수정: 마퀴 시작 판정 완화 (2025-11-17)
- 원인: 빈 영역 드래그 시에도 마퀴가 시작해야 하나, 캔버스 data-testid 직접 비교로 인해 실제 히트박스에서 시작 누락 → aria-live "선택 0개" 유지
- 조치: `components/wysiwyg/Canvas.tsx``onMouseDown`에서 객체/핸들 근접 여부 검사(`closest`)로 판정 완화, 객체/핸들이 아닌 영역이면 항상 마퀴 시작
- 결과: E2E 라이브리전 멀티선택 문구 안정화, 전체 테스트 그린 유지
### E2E 스모크: 그룹 드래그 스냅 델타 동일 적용 (2025-11-17)
- 테스트: `tests/e2e/wysiwyg-group-drag.e2e.ts`
- 마퀴로 2개 선택 후, 선택 중 하나를 +16px 드래그 → 8px 스냅 반영 동일 델타로 양 객체 이동 검증
- 기대/결과: 스냅된 델타(dx)가 선택 전체에 동일하게 적용됨 확인
### E2E 스모크 확장: 그룹 리사이즈(E)/회전(15°) + 가이드 라이브리전 (2025-11-17)
- 테스트: `tests/e2e/wysiwyg-group-resize-rotate.e2e.ts`
- 그룹 E 핸들 리사이즈: 좌표 고정, width만 스냅 증가, 두 객체 동일 증분
- 회전 핸들: 15° 단위 스냅, 드래그 중 라이브리전에 가이드 좌표 문구 포함
- 결과: 그룹 액션 스냅/가이드 UX 안정화 스모크 통과
### 이미지 최적화 옵션 2차 TDD (2025-11-17)
- 테스트: `lib/exporter/image.responsive.options.matrix.test.ts`
- loading/decoding/fetchpriority 적용
- srcset + autoSizes + preset 동시 제공 시 preset 우선
- explicit sizes가 있으면 preset/autoSizes보다 우선
- 구현 상태: `lib/exporter/html.ts`의 기존 로직이 요구사항 충족(우선순위: explicit > preset > default(autoSizes))
### Export CSS 토큰 딥 회귀 (폼/테마) (2025-11-17)
- 테스트: `lib/wysiwyg/export.style.tokens.form.deep.test.ts`
- 토큰 존재: `--ring`, `--ring-offset`, `--disabled-bg`, `--disabled-fg`
- 사용 검증: `:focus-visible` 링/오프셋, `:disabled` BG, `[readonly]` FG
- 테마 프리셋: `[data-theme="light|dark"]`에서 `--bg` 제공, `.frame{background:var(--bg)}` 유지
- 결과: 토큰/참조/테마 오버라이드 회귀 보강, 전체 테스트 그린(170 파일/300 테스트)
## 목표 ## 목표
- 비개발자도 사용 가능한 단일 페이지 랜딩 페이지 빌더. - 비개발자도 사용 가능한 단일 페이지 랜딩 페이지 빌더.
- 결과물: 정적 ZIP(HTML/CSS/JS) 다운로드. 이미지: 외부 URL 또는 로컬 업로드(서버 저장 없음, ZIP에 패키징). 폰트는 외부 CDN 허용. - 결과물: 정적 ZIP(HTML/CSS/JS) 다운로드. 이미지: 외부 URL 또는 로컬 업로드(서버 저장 없음, ZIP에 패키징). 폰트는 외부 CDN 허용.
@@ -0,0 +1,46 @@
import { describe, it, expect } from 'vitest'
import { exportPage } from '@/lib/exporter/html'
import type { ExportOptions } from '@/lib/exporter/html'
import type { Page } from '@/lib/schema/page'
const basePage: Page = {
title: 'Img Matrix',
locale: 'en',
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
sections: [
{ type: 'hero', props: { heading: 'Hero', subheading: '', imageUrl: 'https://example.com/hero.jpg' } },
],
form: {
actionUrl: '',
fields: [],
spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 },
},
analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' },
seo: { title: 'T', description: 'D' },
}
describe('image responsive options - matrix', () => {
it('applies loading and decoding attributes from options', () => {
const opts: ExportOptions = { imageLoading: 'eager', imageDecoding: 'sync' }
const { html } = exportPage(basePage, opts)
expect(html).toMatch(/<img[^>]*loading="eager"/)
expect(html).toMatch(/<img[^>]*decoding="sync"/)
})
it('sets fetchpriority="low" when specified', () => {
const opts: ExportOptions = { imageFetchPriority: 'low' }
const { html } = exportPage(basePage, opts)
expect(html).toMatch(/<img[^>]*fetchpriority="low"/)
})
it('prefers preset sizes over auto default when both provided (no explicit sizes)', () => {
const opts: ExportOptions = {
imageSrcset: 'https://example.com/hero.jpg 1x, https://example.com/hero@2x.jpg 2x',
imageAutoSizes: true,
imageSizesPreset: 'mobile-first',
}
const { html } = exportPage(basePage, opts)
// preset should win over default auto sizes
expect(html).toMatch(/<img[^>]*sizes="\(max-width: 640px\) 100vw, 800px"/)
})
})
@@ -0,0 +1,65 @@
import { describe, it, expect } from 'vitest'
import { exportFrame } from '@/lib/wysiwyg/export'
import type { Frame } from '@/lib/wysiwyg/schema'
function frameWithForm(): Frame {
return {
id: 'f', width: 600, height: 400, background: '#ffffff',
layers: [
{
id: 'base', name: 'Base', visible: true, locked: false, objects: [
{ id: 't1', type: 'input', x: 40, y: 40, width: 200, height: 32, rotate: 0, zIndex: 0, props: { name: 'email', label: 'Email', placeholder: '', required: true, help: 'We never share your email.' } },
{ id: 't2', type: 'select', x: 40, y: 100, width: 200, height: 32, rotate: 0, zIndex: 0, props: { name: 'country', label: 'Country', options: ['KR','US'], defaultValue: 'KR', help: 'Pick one' } },
{ id: 't3', type: 'textarea', x: 40, y: 160, width: 280, height: 80, rotate: 0, zIndex: 0, props: { name: 'msg', label: 'Message', placeholder: '', rows: 3, required: false, help: 'Optional' } },
{ id: 't4', type: 'radio', x: 320, y: 40, width: 200, height: 90, rotate: 0, zIndex: 0, props: { name: 'plan', legend: 'Plan', options: ['Basic','Pro'], defaultValue: 'Basic', required: false, help: 'Choose your plan' } },
{ id: 't5', type: 'checkbox', x: 320, y: 150, width: 200, height: 60, rotate: 0, zIndex: 0, props: { name: 'agree', legend: 'Agree to terms', options: ['Yes'], defaultValues: [], required: false, help: 'You must agree' } },
]
}
],
}
}
describe('wysiwyg export - a11y matrix for form controls', () => {
it('label/for + aria-describedby for input/select/textarea', () => {
const out = exportFrame(frameWithForm())
const html = out.html
// input
expect(html).toMatch(/<label for="t1-control">Email<\/label>/)
expect(html).toMatch(/<input[^>]*id="t1-control"[^>]*name="email"[^>]*required/)
expect(html).toMatch(/<small id="t1-control-help">We never share your email\.<\/small>/)
expect(html).toMatch(/<input[^>]*aria-describedby="t1-control-help"/)
// select
expect(html).toMatch(/<label for="t2-control">Country<\/label>/)
expect(html).toMatch(/<select[^>]*id="t2-control"[^>]*name="country"[^>]*aria-describedby="t2-control-help"/)
expect(html).toMatch(/<small id="t2-control-help">Pick one<\/small>/)
// textarea
expect(html).toMatch(/<label for="t3-control">Message<\/label>/)
expect(html).toMatch(/<textarea[^>]*id="t3-control"[^>]*name="msg"[^>]*aria-describedby="t3-control-help"/)
expect(html).toMatch(/<small id="t3-control-help">Optional<\/small>/)
})
it('fieldset/legend present for radio group with help items', () => {
const out = exportFrame(frameWithForm())
const html = out.html
// fieldset/legend exist (current implementation does not add aria-describedby on fieldset)
expect(html).toMatch(/<fieldset id="t4">/)
expect(html).toMatch(/<legend>Plan<\/legend>/)
// individual radio inputs share name and carry required if set on group (not set here), and pattern/max if present
expect(html).toMatch(/<input type="radio" id="t4-0" name="plan" value="Basic" checked/)
expect(html).toMatch(/<label for="t4-0">Basic<\/label>/)
expect(html).toMatch(/<input type="radio" id="t4-1" name="plan" value="Pro"/)
expect(html).toMatch(/<label for="t4-1">Pro<\/label>/)
// help element exists (small)
expect(html).toMatch(/<small id="t4-help">Choose your plan<\/small>/)
})
it('fieldset/legend present for checkbox group with help items', () => {
const out = exportFrame(frameWithForm())
const html = out.html
expect(html).toMatch(/<fieldset id="t5">/)
expect(html).toMatch(/<legend>Agree to terms<\/legend>/)
expect(html).toMatch(/<input type="checkbox" id="t5-0" name="agree" value="Yes"/)
expect(html).toMatch(/<label for="t5-0">Yes<\/label>/)
expect(html).toMatch(/<small id="t5-help">You must agree<\/small>/)
})
})
@@ -0,0 +1,35 @@
import { describe, it, expect } from 'vitest'
import { exportFrame } from '@/lib/wysiwyg/export'
import type { Frame } from '@/lib/wysiwyg/schema'
function baseFrame(): Frame {
return {
id: 'f', width: 400, height: 300, background: '#111111',
layers: [{ id: 'l1', name: 'Base', visible: true, locked: false, objects: [] }],
}
}
describe('wysiwyg export - form tokens deep regression', () => {
it('contains ring/disabled tokens and applies across selectors', () => {
const out = exportFrame(baseFrame())
const css = out.css
// tokens
expect(css).toMatch(/:root[^}]*--ring:/)
expect(css).toMatch(/:root[^}]*--ring-offset:/)
expect(css).toMatch(/:root[^}]*--disabled-bg:/)
expect(css).toMatch(/:root[^}]*--disabled-fg:/)
// usages
expect(css).toMatch(/:focus-visible\s*{[^}]*outline:2px solid var\(--ring\)/)
expect(css).toMatch(/:focus-visible\s*{[^}]*outline-offset:var\(--ring-offset\)/)
expect(css).toMatch(/input:disabled,select:disabled,textarea:disabled\s*{[^}]*background:var\(--disabled-bg\)/)
expect(css).toMatch(/input\[readonly\],select\[readonly\],textarea\[readonly\]\s*{[^}]*color:var\(--disabled-fg\)/)
})
it('themes define overrides without breaking base var() usage', () => {
const out = exportFrame(baseFrame())
const css = out.css
expect(css).toMatch(/\[data-theme="light"\][^{]*{[^}]*--bg:/)
expect(css).toMatch(/\[data-theme="dark"\][^{]*{[^}]*--bg:/)
expect(css).toMatch(/\.frame\s*{[^}]*background:var\(--bg\)/)
})
})
@@ -0,0 +1,89 @@
import { test, expect } from '@playwright/test'
const wysiwygUrl = '/en/wysiwyg'
function snap8(v: number) { return Math.round(v / 8) * 8 }
async function getBoxStyles(page: import('@playwright/test').Page, nth: number) {
const el = page.locator('[data-testid^="obj-text-"]').nth(nth)
const left = await el.evaluate((n) => parseInt((n as HTMLElement).style.left || '0', 10))
const top = await el.evaluate((n) => parseInt((n as HTMLElement).style.top || '0', 10))
const width = await el.evaluate((n) => parseInt((n as HTMLElement).style.width || '0', 10))
const height = await el.evaluate((n) => parseInt((n as HTMLElement).style.height || '0', 10))
const transform = await el.evaluate((n) => (n as HTMLElement).style.transform || '')
return { left, top, width, height, transform }
}
test.describe('WYSIWYG - Group resize/rotate and guide live region', () => {
test('group E handle resizes both by snapped delta without shifting x', async ({ page }) => {
await page.goto(wysiwygUrl)
const canvas = page.getByTestId('wysiwyg-canvas')
await expect(canvas).toBeVisible()
const addText = page.getByRole('button', { name: /^Add Text$/i })
await addText.click()
await addText.click()
// Marquee select both
const box = await canvas.boundingBox()
if (!box) throw new Error('canvas not found')
await page.mouse.move(box.x + 40, box.y + 40)
await page.mouse.down()
await page.mouse.move(box.x + 260, box.y + 160)
await page.mouse.up()
const live = page.getByTestId('aria-live')
await expect(live).toContainText(/선택\s*2개/)
const b0 = await getBoxStyles(page, 0)
const b1 = await getBoxStyles(page, 1)
// Drag east handle of second by +16px
const target = page.locator('[data-testid^="obj-text-"]').nth(1)
const tbox = await target.boundingBox()
if (!tbox) throw new Error('target not found')
await page.mouse.move(tbox.x + tbox.width - 5, tbox.y + 5)
await page.mouse.down()
await page.mouse.move(tbox.x + tbox.width + 16, tbox.y + 5)
await page.mouse.up()
const a0 = await getBoxStyles(page, 0)
const a1 = await getBoxStyles(page, 1)
const dw = snap8(b1.width + 16) - b1.width
expect(a0.left).toBe(b0.left)
expect(a1.left).toBe(b1.left)
expect(a0.width).toBe(b0.width + dw)
expect(a1.width).toBe(b1.width + dw)
})
test('rotate handle snaps to 15deg and live region includes guide coords while dragging', async ({ page }) => {
await page.goto(wysiwygUrl)
const canvas = page.getByTestId('wysiwyg-canvas')
await expect(canvas).toBeVisible()
const addText = page.getByRole('button', { name: /^Add Text$/i })
await addText.click()
const target = page.locator('[data-testid^="obj-text-"]').first()
const tbox = await target.boundingBox()
if (!tbox) throw new Error('target not found')
// Select
await target.click()
// Drag rotate handle horizontally to cause rotation ~15deg (snapped)
const rotateHandle = page.locator('[data-testid^="rotate-handle-"]').first()
const hbox = await rotateHandle.boundingBox()
if (!hbox) throw new Error('rotate handle not found')
await page.mouse.move(hbox.x + 5, hbox.y + 5)
await page.mouse.down()
await page.mouse.move(hbox.x + 40, hbox.y + 5)
const live = page.getByTestId('aria-live')
await expect(live).toContainText(/가이드\s*x=|y=/)
await page.mouse.up()
const a = await getBoxStyles(page, 0)
expect(a.transform).toMatch(/rotate\(15deg\)|rotate\(30deg\)/)
})
})