Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Sep 19, 2024
1 parent 457897e commit 50cc9cd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playground/vue/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</div>
<HmrCircularReference name="test" />
<TypeProps msg="msg" bar="bar" :id="123" />
<TypePropsTsx msg="msg" bar="bar" />
<Syntax />
<PreProcessors />
<PreProcessorsHmr />
Expand Down Expand Up @@ -56,6 +57,7 @@ import WorkerTest from './worker.vue'
import { ref } from 'vue'
import Url from './Url.vue'
import TypeProps from './TypeProps.vue'
import TypePropsTsx from './TypePropsTsx.vue'
import DefaultLangs from './DefaultLangs.vue'
import PreCompiled from './pre-compiled/foo.vue'
import PreCompiledExternalScoped from './pre-compiled/external-scoped.vue'
Expand Down
10 changes: 10 additions & 0 deletions playground/vue/TypePropsTsx.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script setup lang="tsx">
import type { Props } from './types'
const props = defineProps<Props & { bar: string }>()
</script>

<template>
<h2>Imported Type Props</h2>
<pre class="type-props-tsx">{{ props }}</pre>
</template>
14 changes: 14 additions & 0 deletions playground/vue/__tests__/vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,20 @@ describe('macro imported types', () => {
),
)
})

test('should hmr with lang=tsx', async () => {
editFile('types.ts', (code) => code.replace('msg: string', ''))
await untilUpdated(
() => page.textContent('.type-props-tsx'),
JSON.stringify(
{
bar: 'bar',
},
null,
2,
),
)
})
})

test('TS with generics', async () => {
Expand Down

0 comments on commit 50cc9cd

Please sign in to comment.