auto: PR for feat/wysiwyg-route #75
@@ -0,0 +1,5 @@
|
|||||||
|
import WysiwygPage from '@/components/wysiwyg/WysiwygPage'
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <WysiwygPage />
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { render, screen } from '@testing-library/react'
|
||||||
|
import { WysiwygPage } from '@/components/wysiwyg/WysiwygPage'
|
||||||
|
|
||||||
|
describe('WysiwygPage', () => {
|
||||||
|
it('renders Canvas with a sample frame and aria-live region', () => {
|
||||||
|
render(<WysiwygPage />)
|
||||||
|
const canvas = screen.getByTestId('wysiwyg-canvas')
|
||||||
|
expect(canvas).toBeInTheDocument()
|
||||||
|
// at least one object is present
|
||||||
|
expect(screen.getByTestId('obj-o1')).toBeInTheDocument()
|
||||||
|
// a11y live region exists
|
||||||
|
expect(screen.getByTestId('aria-live')).toBeInTheDocument()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { Canvas } from '@/components/wysiwyg/Canvas'
|
||||||
|
import type { Frame } from '@/lib/wysiwyg/schema'
|
||||||
|
|
||||||
|
function sampleFrame(): Frame {
|
||||||
|
return {
|
||||||
|
id: 'f-sample',
|
||||||
|
width: 600,
|
||||||
|
height: 400,
|
||||||
|
background: '#ffffff',
|
||||||
|
layers: [
|
||||||
|
{
|
||||||
|
id: 'l1',
|
||||||
|
name: 'Base',
|
||||||
|
visible: true,
|
||||||
|
locked: false,
|
||||||
|
objects: [
|
||||||
|
{ id: 'o1', type: 'image', x: 40, y: 40, width: 100, height: 80, rotate: 0, zIndex: 0, props: { src: 'https://via.placeholder.com/100x80', alt: 'A' } },
|
||||||
|
{ id: 'o2', type: 'text', x: 200, y: 60, width: 200, height: 40, rotate: 0, zIndex: 1, props: { text: 'WYSIWYG', fontSize: 20, color: '#111111' } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WysiwygPage() {
|
||||||
|
const frame = sampleFrame()
|
||||||
|
return (
|
||||||
|
<div className="p-6 space-y-4">
|
||||||
|
<h1 className="text-xl font-semibold">WYSIWYG Canvas</h1>
|
||||||
|
<Canvas frame={frame} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WysiwygPage
|
||||||
Reference in New Issue
Block a user