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 {
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}
3444const 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)
6178export default { }
You can’t perform that action at this time.
0 commit comments