@@ -146,6 +146,7 @@ if (_.inBrowser) {
146
146
} )
147
147
148
148
it ( 'props' , function ( ) {
149
+ var bindingModes = Vue . config . _propBindingModes
149
150
var options = _ . mergeOptions ( Vue . options , {
150
151
_asComponent : true ,
151
152
props : [
@@ -154,8 +155,7 @@ if (_.inBrowser) {
154
155
'some-other-attr' ,
155
156
'multiple-attrs' ,
156
157
'onetime' ,
157
- 'oneway-up' ,
158
- 'oneway-down' ,
158
+ 'twoway' ,
159
159
'with-filter' ,
160
160
'camelCase' ,
161
161
'boolean-literal'
@@ -167,52 +167,44 @@ if (_.inBrowser) {
167
167
el . setAttribute ( 'some-other-attr' , '2' )
168
168
el . setAttribute ( 'multiple-attrs' , 'a {{b}} c' )
169
169
el . setAttribute ( 'onetime' , '{{*a}}' )
170
- el . setAttribute ( 'oneway-up' , '{{>a}}' )
171
- el . setAttribute ( 'oneway-down' , '{{<a}}' )
170
+ el . setAttribute ( 'twoway' , '{{@a}}' )
172
171
el . setAttribute ( 'with-filter' , '{{a | filter}}' )
173
172
el . setAttribute ( 'boolean-literal' , '{{true}}' )
174
173
transclude ( el , options )
175
174
compiler . compileAndLinkRoot ( vm , el , options )
176
175
// should skip literals and one-time bindings
177
- expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 5 )
176
+ expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 4 )
178
177
// data-some-attr
179
178
var args = vm . _bindDir . calls . argsFor ( 0 )
180
179
expect ( args [ 0 ] ) . toBe ( 'prop' )
181
180
expect ( args [ 1 ] ) . toBe ( null )
182
181
expect ( args [ 2 ] . path ) . toBe ( 'someAttr' )
183
182
expect ( args [ 2 ] . parentPath ) . toBe ( 'a' )
183
+ expect ( args [ 2 ] . mode ) . toBe ( bindingModes . ONE_WAY )
184
184
expect ( args [ 3 ] ) . toBe ( def )
185
185
// multiple-attrs
186
186
args = vm . _bindDir . calls . argsFor ( 1 )
187
187
expect ( args [ 0 ] ) . toBe ( 'prop' )
188
188
expect ( args [ 1 ] ) . toBe ( null )
189
189
expect ( args [ 2 ] . path ) . toBe ( 'multipleAttrs' )
190
190
expect ( args [ 2 ] . parentPath ) . toBe ( '"a "+(b)+" c"' )
191
+ expect ( args [ 2 ] . mode ) . toBe ( bindingModes . ONE_WAY )
191
192
expect ( args [ 3 ] ) . toBe ( def )
192
- // one way up
193
+ // two way
193
194
args = vm . _bindDir . calls . argsFor ( 2 )
194
195
expect ( args [ 0 ] ) . toBe ( 'prop' )
195
196
expect ( args [ 1 ] ) . toBe ( null )
196
- expect ( args [ 2 ] . path ) . toBe ( 'onewayUp' )
197
- expect ( args [ 2 ] . oneWayUp ) . toBe ( true )
198
- expect ( args [ 2 ] . oneWayDown ) . toBe ( false )
199
- expect ( args [ 2 ] . parentPath ) . toBe ( 'a' )
200
- expect ( args [ 3 ] ) . toBe ( def )
201
- // one way down
202
- args = vm . _bindDir . calls . argsFor ( 3 )
203
- expect ( args [ 0 ] ) . toBe ( 'prop' )
204
- expect ( args [ 1 ] ) . toBe ( null )
205
- expect ( args [ 2 ] . path ) . toBe ( 'onewayDown' )
206
- expect ( args [ 2 ] . oneWayUp ) . toBe ( false )
207
- expect ( args [ 2 ] . oneWayDown ) . toBe ( true )
197
+ expect ( args [ 2 ] . path ) . toBe ( 'twoway' )
198
+ expect ( args [ 2 ] . mode ) . toBe ( bindingModes . TWO_WAY )
208
199
expect ( args [ 2 ] . parentPath ) . toBe ( 'a' )
209
200
expect ( args [ 3 ] ) . toBe ( def )
210
201
// with-filter
211
- args = vm . _bindDir . calls . argsFor ( 4 )
202
+ args = vm . _bindDir . calls . argsFor ( 3 )
212
203
expect ( args [ 0 ] ) . toBe ( 'prop' )
213
204
expect ( args [ 1 ] ) . toBe ( null )
214
205
expect ( args [ 2 ] . path ) . toBe ( 'withFilter' )
215
206
expect ( args [ 2 ] . parentPath ) . toBe ( 'this._applyFilters(a,null,[{"name":"filter"}],false)' )
207
+ expect ( args [ 2 ] . mode ) . toBe ( bindingModes . ONE_WAY )
216
208
expect ( args [ 3 ] ) . toBe ( def )
217
209
// camelCase should've warn
218
210
expect ( hasWarned ( _ , 'using camelCase' ) ) . toBe ( true )
0 commit comments