Skip to content

Commit

Permalink
test: test vue ref transform
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 24, 2021
1 parent e7263b9 commit 4649a7f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/playground/vue/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Suspense>
<AsyncComponent />
</Suspense>
<RefTransform />
</template>

<script setup lang="ts">
Expand All @@ -31,6 +32,7 @@ import SrcImport from './src-import/SrcImport.vue'
import Slotted from './Slotted.vue'
import ScanDep from './ScanDep.vue'
import AsyncComponent from './AsyncComponent.vue'
import RefTransform from './RefTransform.vue'
import { ref } from 'vue'
Expand Down
9 changes: 9 additions & 0 deletions packages/playground/vue/RefTransform.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup>
let a = $ref(0)
const inc = () => a++
</script>

<template>
<h2>Ref Transform</h2>
<button class="ref-transform" @click="inc">{{ a }}</button>
</template>
8 changes: 8 additions & 0 deletions packages/playground/vue/__tests__/vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,11 @@ describe('async component', () => {
expect(await page.textContent('.async-component')).toMatch('ab == ab')
})
})

describe('ref transform', () => {
test('should work', async () => {
expect(await page.textContent('.ref-transform')).toMatch('0')
await page.click('.ref-transform')
expect(await page.textContent('.ref-transform')).toMatch('1')
})
})
7 changes: 6 additions & 1 deletion packages/playground/vue/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export default defineConfig({
'/@': __dirname
}
},
plugins: [vuePlugin(), vueI18nPlugin],
plugins: [
vuePlugin({
refTransform: true
}),
vueI18nPlugin
],
build: {
// to make tests faster
// minify: false
Expand Down

0 comments on commit 4649a7f

Please sign in to comment.