feat(watch): support dot-delimited path in watch option
This commit is contained in:
@@ -113,6 +113,7 @@ describe('api: options', () => {
|
||||
const spyB = jest.fn(returnThis)
|
||||
const spyC = jest.fn(returnThis)
|
||||
const spyD = jest.fn(returnThis)
|
||||
const spyE = jest.fn(returnThis)
|
||||
|
||||
let ctx: any
|
||||
const Comp = {
|
||||
@@ -123,7 +124,10 @@ describe('api: options', () => {
|
||||
baz: {
|
||||
qux: 3
|
||||
},
|
||||
qux: 4
|
||||
qux: 4,
|
||||
dot: {
|
||||
path: 5
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -137,7 +141,8 @@ describe('api: options', () => {
|
||||
},
|
||||
qux: {
|
||||
handler: 'onQuxChange'
|
||||
}
|
||||
},
|
||||
'dot.path': spyE
|
||||
},
|
||||
methods: {
|
||||
onFooChange: spyA,
|
||||
@@ -175,6 +180,11 @@ describe('api: options', () => {
|
||||
await nextTick()
|
||||
expect(spyD).toHaveBeenCalledTimes(1)
|
||||
assertCall(spyD, 0, [5, 4])
|
||||
|
||||
ctx.dot.path++
|
||||
await nextTick()
|
||||
expect(spyE).toHaveBeenCalledTimes(1)
|
||||
assertCall(spyE, 0, [6, 5])
|
||||
})
|
||||
|
||||
test('watch array', async () => {
|
||||
|
||||
Reference in New Issue
Block a user