Skip to content

Commit c675714

Browse files
committed
test
1 parent 5eeb6ec commit c675714

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/option/watch.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ export class Comp extends Base {
3030
arrayWatcher2() {
3131
return 'arrayWatcher2 value'
3232
}
33+
34+
@Watch('multiKey1', {
35+
immediate: true
36+
})
37+
@Watch('multiKey2', {
38+
39+
})
40+
multiKeyWatcher() {
41+
return 'multiKeyWatcher value'
42+
}
3343
}
3444
const CompContext = Comp as any
3545

@@ -56,6 +66,13 @@ describe('decorator Watch',
5666
expect('function').to.equal(typeof CompContext?.methods?.defaultWatcher)
5767
expect('defaultWatcher test value').to.equal(CompContext.methods.defaultWatcher())
5868
})
69+
it('multi key', () => {
70+
expect('function').to.equal(typeof CompContext?.watch?.multiKey1?.handler)
71+
expect('function').to.equal(typeof CompContext?.watch?.multiKey2?.handler)
72+
expect(true).to.equal(CompContext.watch.multiKey1.handler === CompContext.watch.multiKey2.handler)
73+
expect(true).to.equal(!! CompContext.watch.multiKey1.immediate)
74+
expect(false).to.equal(!! CompContext.watch.multiKey2.immediate)
75+
})
5976
}
6077
)
6178
export default {}

0 commit comments

Comments
 (0)