@@ -14,32 +14,66 @@ import {
14
14
15
15
let vt
16
16
17
- test . skip ( 'before' , t => {
17
+ test ( 'prop is true by default & events are enabled' , t => {
18
+ t . plan ( 2 )
18
19
19
- vt = createFromTemplate ( `
20
+ const vt = createFromTemplate ( `
20
21
<v-touch
21
22
@tap="cb"
22
23
@swipe="cb"
23
24
/>
24
25
` )
26
+ const propEnabled = vt . enabled
27
+ t . true ( propEnabled )
28
+
29
+ const rcEnabled = isEnabled ( vt , 'tap' )
30
+ t . true ( rcEnabled )
25
31
} )
26
32
27
- test ( 'prop is true by default & events are enabled' , t => {
33
+ test ( 'all rcg disabled when enabled="false" ' , t => {
28
34
t . plan ( 2 )
29
35
30
- vt = createFromTemplate ( `
36
+ const vt = createFromTemplate ( `
31
37
<v-touch
32
- @tap="cb"
33
- @swipe="cb"
38
+ v-bind:enabled="false"
39
+ v-on:tap="cb"
40
+ v-on:swipe="cb"
34
41
/>
35
42
` )
36
- const propEnabled = vt . enabled
37
- t . true ( propEnabled )
38
43
39
- const rcEnabled = isEnabled ( vm , 'tap' )
40
- t . true ( rcEnabled )
44
+ t . false ( vt . enabled )
45
+ const areAllDisabled = allDisabled ( vt )
46
+ t . true ( areAllDisabled )
41
47
} )
42
48
43
- test . todo ( 'all rcg disabled when enabled="false"' )
49
+ test . cb ( 'Passing obj to enabled prop correctly toggles recognizers' , t => {
50
+ t . plan ( 2 )
51
+
52
+ const vt = createFromTemplate ( `
53
+ <v-touch
54
+ v-bind:enabled="{ tap: true, swipe: false }"
55
+ v-on:tap="cb"
56
+ v-on:swipe="cb"
57
+ />
58
+ ` )
59
+
60
+ vt . $nextTick ( )
61
+ . then ( ( ) => {
62
+ const tapEnabled = isEnabled ( vt , 'tap' )
63
+ const swipeDisabled = isDisabled ( vt , 'swipe' )
64
+ t . true ( tapEnabled && swipeDisabled )
65
+ } )
66
+
67
+ . then ( ( ) => {
68
+ vt . updateEnabled ( { tap : false , swipe : true } )
44
69
45
- test . todo ( 'Passing obj to enabled prop correctly toggles recognizers' )
70
+ return vt . $nextTick ( )
71
+ } )
72
+
73
+ . then ( ( ) => {
74
+ const tapDisabled = isDisabled ( vt , 'tap' )
75
+ const swipeEnabled = isEnabled ( vt , 'swipe' )
76
+ t . true ( tapDisabled && swipeEnabled )
77
+ t . end ( )
78
+ } )
79
+ } )
0 commit comments