File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
packages/vitest/src/create/browser Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,38 @@ test('renders name', async () => {
227227` ,
228228}
229229
230+ const preactExample = {
231+ name : 'HelloWorld.jsx' ,
232+ js : `
233+ export default function HelloWorld({ name }) {
234+ return (
235+ <div>
236+ <h1>Hello {name}!</h1>
237+ </div>
238+ )
239+ }
240+ ` ,
241+ ts : `
242+ export default function HelloWorld({ name }: { name: string }) {
243+ return (
244+ <div>
245+ <h1>Hello {name}!</h1>
246+ </div>
247+ )
248+ }
249+ ` ,
250+ test : `
251+ import { expect, test } from 'vitest'
252+ import { render } from 'vitest-browser-preact'
253+ import HelloWorld from './HelloWorld.<EXT>x'
254+
255+ test('renders name', async () => {
256+ const { getByText } = render(<HelloWorld name="Vitest" />)
257+ await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
258+ })
259+ ` ,
260+ }
261+
230262const vanillaExample = {
231263 name : 'HelloWorld.js' ,
232264 js : `
@@ -274,6 +306,7 @@ function getExampleTest(framework: string) {
274306 test : jsxExample . test . replace ( '@testing-library/jsx' , `@testing-library/${ framework } ` ) ,
275307 }
276308 case 'preact' :
309+ return preactExample
277310 case 'react' :
278311 return {
279312 ...jsxExample ,
You can’t perform that action at this time.
0 commit comments