@@ -177,7 +177,11 @@ if (_.inBrowser) {
177
177
}
178
178
}
179
179
} ,
180
- 'withDataPrefix'
180
+ 'withDataPrefix' ,
181
+ {
182
+ name : 'forceTwoWay' ,
183
+ twoWay : true
184
+ }
181
185
] . map ( function ( p ) {
182
186
return typeof p === 'string' ? { name : p } : p
183
187
} )
@@ -193,9 +197,10 @@ if (_.inBrowser) {
193
197
el . setAttribute ( 'boolean-literal' , '{{true}}' )
194
198
el . setAttribute ( 'boolean' , '' )
195
199
el . setAttribute ( 'data-with-data-prefix' , '1' )
200
+ el . setAttribute ( 'force-two-way' , '{{a}}' )
196
201
compiler . compileAndLinkProps ( vm , el , props )
197
202
// should skip literals and one-time bindings
198
- expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 4 )
203
+ expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 5 )
199
204
// data-some-attr
200
205
var args = vm . _bindDir . calls . argsFor ( 0 )
201
206
expect ( args [ 0 ] ) . toBe ( 'prop' )
@@ -228,6 +233,8 @@ if (_.inBrowser) {
228
233
expect ( args [ 2 ] . parentPath ) . toBe ( 'this._applyFilters(a,null,[{"name":"filter"}],false)' )
229
234
expect ( args [ 2 ] . mode ) . toBe ( bindingModes . ONE_WAY )
230
235
expect ( args [ 3 ] ) . toBe ( def )
236
+ // warn when expecting two-way binding but not getting it
237
+ expect ( hasWarned ( _ , 'expects a two-way binding type' ) ) . toBe ( true )
231
238
// literal and one time should've been set on the _data
232
239
// and numbers should be casted
233
240
expect ( Object . keys ( vm . _data ) . length ) . toBe ( 10 )
0 commit comments