File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,36 @@ describe('debug', () => {
31
31
name : 'foo' ,
32
32
} )
33
33
} )
34
+ test ( 'watching states with calling the debug function multiple times' , ( ) => {
35
+ const root = nodeOps . createElement ( 'div' )
36
+ let instance : ComponentInternalInstance
37
+ const Comp = defineComponent ( {
38
+ setup ( ) {
39
+ const name = ref ( 'foo' )
40
+ const age = ref ( 100 )
41
+ debug ( {
42
+ name,
43
+ } )
44
+ debug ( {
45
+ age,
46
+ name,
47
+ } )
48
+ debug ( {
49
+ name,
50
+ } )
51
+ return ( ) => (
52
+ h ( 'div' , name . value )
53
+ )
54
+ } ,
55
+ mounted ( ) {
56
+ instance = getCurrentInstance ( ) !
57
+ } ,
58
+ } )
59
+ render ( h ( Comp ) , root )
60
+ expect ( inner ( root ) ) . toBe ( '<div>foo</div>' )
61
+ expect ( instance ! . setupState ) . toEqual ( {
62
+ name : 'foo' ,
63
+ age : 100 ,
64
+ } )
65
+ } )
34
66
} )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import {getCurrentInstance} from './component'
6
6
* @example
7
7
* const Component = defineComponent({
8
8
* setup() {
9
- * const name = ref('foo')
9
+ * const name = ref('foo')
10
10
* debug({
11
11
* // watch states in the vue devtool
12
12
* name,
You can’t perform that action at this time.
0 commit comments