File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ export const nextTick: NextTick = function nextTick(
7
7
this : ThisType < NextTick > ,
8
8
...args : Parameters < NextTick >
9
9
) {
10
- return currentVue ?. nextTick . bind ( this , args )
10
+ return currentVue ?. nextTick . apply ( this , args )
11
11
} as any
Original file line number Diff line number Diff line change @@ -26,4 +26,27 @@ describe('nextTick', () => {
26
26
} )
27
27
} )
28
28
} )
29
+
30
+ it ( 'should works with await' , async ( ) => {
31
+ const vm = new Vue ( {
32
+ template : `<div>{{a}}</div>` ,
33
+ setup ( ) {
34
+ return {
35
+ a : ref ( 1 ) ,
36
+ }
37
+ } ,
38
+ } ) . $mount ( )
39
+
40
+ expect ( vm . $el . textContent ) . toBe ( '1' )
41
+ vm . a = 2
42
+ expect ( vm . $el . textContent ) . toBe ( '1' )
43
+
44
+ await nextTick ( )
45
+ expect ( vm . $el . textContent ) . toBe ( '2' )
46
+ vm . a = 3
47
+ expect ( vm . $el . textContent ) . toBe ( '2' )
48
+
49
+ await nextTick ( )
50
+ expect ( vm . $el . textContent ) . toBe ( '3' )
51
+ } )
29
52
} )
You can’t perform that action at this time.
0 commit comments