24 lines
935 B
TypeScript
24 lines
935 B
TypeScript
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: 320, height: 200, background: '#111111',
|
|
layers: [{ id: 'l1', name: 'Base', visible: true, locked: false, objects: [] }],
|
|
}
|
|
}
|
|
|
|
describe('wysiwyg export - control state styles via tokens', () => {
|
|
it('adds :focus styles using tokens', () => {
|
|
const out = exportFrame(baseFrame())
|
|
expect(out.css).toMatch(/:root[^}]*--primary:/)
|
|
expect(out.css).toMatch(/input:focus,select:focus,textarea:focus\s*{[^}]*outline:2px solid var\(--primary\)/)
|
|
})
|
|
it('adds :invalid styles using tokens', () => {
|
|
const out = exportFrame(baseFrame())
|
|
expect(out.css).toMatch(/:root[^}]*--danger:/)
|
|
expect(out.css).toMatch(/input:invalid,select:invalid,textarea:invalid\s*{[^}]*border-color:var\(--danger\)/)
|
|
})
|
|
})
|