auto: PR for feat/image-opt-2nd #81
@@ -0,0 +1,34 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { exportFrame } from '@/lib/wysiwyg/export'
|
||||||
|
import type { Frame } from '@/lib/wysiwyg/schema'
|
||||||
|
|
||||||
|
function baseFrame(bg = '#111111'): Frame {
|
||||||
|
return {
|
||||||
|
id: 'f', width: 320, height: 200, background: bg,
|
||||||
|
layers: [{ id: 'l1', name: 'Base', visible: true, locked: false, objects: [] }],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('wysiwyg export - CSS regression (tokens + rules presence)', () => {
|
||||||
|
it('contains core tokens and rules across themes and states', () => {
|
||||||
|
const out = exportFrame(baseFrame('#222222'))
|
||||||
|
const css = out.css
|
||||||
|
// root and theme tokens
|
||||||
|
expect(css).toMatch(/:root\s*{[^}]*--bg:/)
|
||||||
|
expect(css).toMatch(/\[data-theme="light"\]\s*{[^}]*--bg:/)
|
||||||
|
expect(css).toMatch(/\[data-theme="dark"\]\s*{[^}]*--bg:/)
|
||||||
|
// base usage
|
||||||
|
expect(css).toMatch(/\.frame\s*{[^}]*background:var\(--bg\)/)
|
||||||
|
expect(css).toMatch(/a\s*{[^}]*color:var\(--primary\)/)
|
||||||
|
// controls base
|
||||||
|
expect(css).toMatch(/input,select,textarea\s*{[^}]*color:var\(--text\)/)
|
||||||
|
expect(css).toMatch(/input,select,textarea\s*{[^}]*border:1px solid var\(--border\)/)
|
||||||
|
// states
|
||||||
|
expect(css).toMatch(/input:focus,select:focus,textarea:focus\s*{[^}]*outline:2px solid var\(--primary\)/)
|
||||||
|
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:invalid,select:invalid,textarea:invalid\s*{[^}]*border-color:var\(--danger\)/)
|
||||||
|
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\)/)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { test, expect } from '@playwright/test'
|
||||||
|
|
||||||
|
const wysiwygUrl = '/en/wysiwyg'
|
||||||
|
|
||||||
|
test.describe('WYSIWYG - Guides toggle and multiselect live region', () => {
|
||||||
|
test('toggles guides and announces multiselect in aria-live', async ({ page }) => {
|
||||||
|
await page.goto(wysiwygUrl)
|
||||||
|
|
||||||
|
// Canvas and live region present
|
||||||
|
const canvas = page.getByTestId('wysiwyg-canvas')
|
||||||
|
await expect(canvas).toBeVisible()
|
||||||
|
const live = page.getByTestId('aria-live')
|
||||||
|
await expect(live).toContainText(/선택\s*0개/)
|
||||||
|
|
||||||
|
// Add two text objects
|
||||||
|
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 + 300, box.y + 200)
|
||||||
|
await page.mouse.up()
|
||||||
|
|
||||||
|
await expect(live).toContainText(/선택\s*2개/)
|
||||||
|
|
||||||
|
// Guides toggle
|
||||||
|
const guidesBtn = page.getByRole('button', { name: /Guides/i })
|
||||||
|
await expect(guidesBtn).toHaveAttribute('aria-pressed', 'true')
|
||||||
|
await guidesBtn.click()
|
||||||
|
await expect(guidesBtn).toHaveAttribute('aria-pressed', 'false')
|
||||||
|
await guidesBtn.click()
|
||||||
|
await expect(guidesBtn).toHaveAttribute('aria-pressed', 'true')
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user