|
|
@@ -86,6 +86,23 @@ describe('api: watch', () => {
|
|
|
expect(dummy).toMatchObject([2, 1])
|
|
|
})
|
|
|
|
|
|
+ it('watching primitive with deep: true', async () => {
|
|
|
+ const count = ref(0)
|
|
|
+ let dummy
|
|
|
+ watch(
|
|
|
+ count,
|
|
|
+ (c, prevCount) => {
|
|
|
+ dummy = [c, prevCount]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ )
|
|
|
+ count.value++
|
|
|
+ await nextTick()
|
|
|
+ expect(dummy).toMatchObject([1, 0])
|
|
|
+ })
|
|
|
+
|
|
|
it('watching multiple sources', async () => {
|
|
|
const state = reactive({ count: 1 })
|
|
|
const count = ref(1)
|