Skip to content

Commit

Permalink
fix: add test for vitejs#28
Browse files Browse the repository at this point in the history
  • Loading branch information
rashfael committed Feb 14, 2023
1 parent 7fec9eb commit 58f129e
Show file tree
Hide file tree
Showing 3 changed files with 20 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>
<Syntax />
<PreProcessors />
<PreProcessorsHmr />
<CssModules />
<Assets />
<CustomBlock />
Expand All @@ -33,6 +34,7 @@ import Hmr from './Hmr.vue'
import HmrTsx from './HmrTsx.vue'
import Syntax from './Syntax.vue'
import PreProcessors from './PreProcessors.vue'
import PreProcessorsHmr from './PreProcessorsHmr.vue'
import CssModules from './CssModules.vue'
import Assets from './Assets.vue'
import CustomBlock from './CustomBlock.vue'
Expand Down
8 changes: 8 additions & 0 deletions playground/vue/PreProcessorsHmr.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lang="pug">
h2.pre-processors-hmr Pre-Processors Hmr
p.pug-hmr {{ preHmr }}
</template>

<script setup>
const preHmr = 'pre-hmr'
</script>
10 changes: 10 additions & 0 deletions playground/vue/__tests__/vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ describe('pre-processors', () => {
)
await untilUpdated(() => getColor('p.pug-stylus'), 'orange')
})

test('pug hmr', async () => {
expect(await page.textContent('p.pug-hmr')).toMatch('pre-hmr')
editFile('PreProcessorsHmr.vue', (code) =>
code
.replace('p.pug-hmr {{ preHmr }}', 'p.pug-hmr {{ postHmr }}')
.replace(`const preHmr = 'pre-hmr'`, `const postHmr = 'post-hmr'`),
)
await untilUpdated(() => page.textContent('p.pug-hmr'), 'post-hmr')
})
})

describe('css modules', () => {
Expand Down

0 comments on commit 58f129e

Please sign in to comment.