Skip to content

Commit 0551106

Browse files
committed
test: use-update
1 parent d5fbe67 commit 0551106

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { mount } from '@vue/test-utils'
2+
import { ref } from 'vue'
3+
4+
import Demo from '../demo/demo.vue'
5+
6+
describe('useUpdate', () => {
7+
const wrapper = mount(Demo)
8+
9+
const showText = wrapper.find('.text')
10+
const btn = wrapper.find('.btn')
11+
12+
const prevRef = ref(showText.text())
13+
14+
it('should work', async () => {
15+
await btn.trigger('click')
16+
expect(showText.text() === prevRef.value).toBeFalsy()
17+
})
18+
})

packages/hooks/src/useUpdate/demo/demo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div>
3-
<div>Time: {{ date }}</div>
4-
<vhp-button type="vhp-button" @click="() => setUpdate()">update</vhp-button>
3+
<div class="text">Time: {{ date }}</div>
4+
<vhp-button class="btn" type="vhp-button" @click="() => setUpdate()">update</vhp-button>
55
</div>
66
</template>
77

0 commit comments

Comments
 (0)