@@ -78,6 +78,68 @@ describe('Filters', () => {
78
78
expect ( vm . $el . textContent ) . toBe ( String ( 1 / 4 ) )
79
79
} )
80
80
81
+ it ( 'handle division with parenthesis' , ( ) => {
82
+ const vm = new Vue ( {
83
+ data : { a : 20 } ,
84
+ template : `<div>{{ (a*2) / 5 | double }}</div>` ,
85
+ filters : { double : v => v * 2 }
86
+ } ) . $mount ( )
87
+ expect ( vm . $el . textContent ) . toBe ( String ( 16 ) )
88
+ } )
89
+
90
+ it ( 'handle division with dot' , ( ) => {
91
+ const vm = new Vue ( {
92
+ template : `<div>{{ 20. / 5 | double }}</div>` ,
93
+ filters : { double : v => v * 2 }
94
+ } ) . $mount ( )
95
+ expect ( vm . $el . textContent ) . toBe ( String ( 8 ) )
96
+ } )
97
+
98
+ it ( 'handle division with array values' , ( ) => {
99
+ const vm = new Vue ( {
100
+ data : { a : [ 20 ] } ,
101
+ template : `<div>{{ a[0] / 5 | double }}</div>` ,
102
+ filters : { double : v => v * 2 }
103
+ } ) . $mount ( )
104
+ expect ( vm . $el . textContent ) . toBe ( String ( 8 ) )
105
+ } )
106
+
107
+ it ( 'handle division with hash values' , ( ) => {
108
+ const vm = new Vue ( {
109
+ data : { a : { n : 20 } } ,
110
+ template : `<div>{{ a['n'] / 5 | double }}</div>` ,
111
+ filters : { double : v => v * 2 }
112
+ } ) . $mount ( )
113
+ expect ( vm . $el . textContent ) . toBe ( String ( 8 ) )
114
+ } )
115
+
116
+ it ( 'handle division with variable++' , ( ) => {
117
+ const vm = new Vue ( {
118
+ data : { a : 7 } ,
119
+ template : `<div>{{ a++ / 2 | double }}</div>` ,
120
+ filters : { double : v => v * 2 }
121
+ } ) . $mount ( )
122
+ expect ( vm . $el . textContent ) . toBe ( String ( 7 ) )
123
+ } )
124
+
125
+ it ( 'handle division with variable--' , ( ) => {
126
+ const vm = new Vue ( {
127
+ data : { a : 7 } ,
128
+ template : `<div>{{ a++ / 2 | double }}</div>` ,
129
+ filters : { double : v => v * 2 }
130
+ } ) . $mount ( )
131
+ expect ( vm . $el . textContent ) . toBe ( String ( 7 ) )
132
+ } )
133
+
134
+ it ( 'handle division with variable_' , ( ) => {
135
+ const vm = new Vue ( {
136
+ data : { a_ : 8 } ,
137
+ template : `<div>{{ a_ / 2 | double }}</div>` ,
138
+ filters : { double : v => v * 2 }
139
+ } ) . $mount ( )
140
+ expect ( vm . $el . textContent ) . toBe ( String ( 8 ) )
141
+ } )
142
+
81
143
it ( 'arguments' , ( ) => {
82
144
const vm = new Vue ( {
83
145
template : `<div>{{ msg | add(a, 3) }}</div>` ,
0 commit comments