Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 24, 2024
1 parent 4e606ae commit 2d585c2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playground/react/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Parent from './hmr/parent'
import { JsxImportRuntime } from './hmr/jsx-import-runtime'
import { CountProvider } from './context/CountProvider'
import { ContextButton } from './context/ContextButton'
import { TestImportAttributes } from './import-attributes/test'

function App() {
const [count, setCount] = useState(0)
Expand Down Expand Up @@ -40,6 +41,7 @@ function App() {
<Parent />
<JsxImportRuntime />
<Button>button</Button>
<TestImportAttributes />
</div>
)
}
Expand Down
4 changes: 4 additions & 0 deletions playground/react/__tests__/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ test.runIf(isServe)(
},
)

test('import attributes', async () => {
expect(await page.textContent('.import-attributes')).toBe('ok')
})

if (!isBuild) {
// #9869
test('should only hmr files with exported react components', async () => {
Expand Down
3 changes: 3 additions & 0 deletions playground/react/import-attributes/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message": "ok"
}
9 changes: 9 additions & 0 deletions playground/react/import-attributes/test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import data from './data.json' with { type: 'json' }

export function TestImportAttributes() {
return (
<div>
import-attirbutes: <span class="import-attributes">{data.message}</span>
</div>
)
}

0 comments on commit 2d585c2

Please sign in to comment.