File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ export class Comp extends Base {
30
30
arrayWatcher2 ( ) {
31
31
return 'arrayWatcher2 value'
32
32
}
33
+
34
+ @Watch ( 'multiKey1' , {
35
+ immediate : true
36
+ } )
37
+ @Watch ( 'multiKey2' , {
38
+
39
+ } )
40
+ multiKeyWatcher ( ) {
41
+ return 'multiKeyWatcher value'
42
+ }
33
43
}
34
44
const CompContext = Comp as any
35
45
@@ -56,6 +66,13 @@ describe('decorator Watch',
56
66
expect ( 'function' ) . to . equal ( typeof CompContext ?. methods ?. defaultWatcher )
57
67
expect ( 'defaultWatcher test value' ) . to . equal ( CompContext . methods . defaultWatcher ( ) )
58
68
} )
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
+ } )
59
76
}
60
77
)
61
78
export default { }
You can’t perform that action at this time.
0 commit comments