@@ -239,22 +239,40 @@ void main() {
239
239
expect (element.text).toEqual ('angular' );
240
240
});
241
241
242
- xit ('should work with attrs, one-way, two-way and callbacks' , async (() {
243
- _.compile ('<div><io bind-attr="\' A\' " bind-expr="name" bind-ondone="done=true"></io></div>' );
242
+ it ('should work with attr bindings' , async (() {
243
+ _.compile ('<div><io bind-attr="\' A\' "></io></div>' );
244
+ microLeap ();
245
+ _.rootScope.apply ();
246
+
247
+ var component = _.rootScope.context['ioComponent' ];
248
+ expect (component.scope.context['attr' ]).toEqual ('A' );
249
+ }));
250
+
251
+ it ('should work with one-way bindings' , async (() {
252
+ _.compile ('<div><io bind-oneway="name"></io></div>' );
253
+ _.rootScope.context['name' ] = 'misko' ;
254
+ microLeap ();
255
+ _.rootScope.apply ();
256
+ var component = _.rootScope.context['ioComponent' ];
257
+ expect (component.scope.context['oneway' ]).toEqual ('misko' );
258
+
259
+ component.scope.context['oneway' ] = 'angular' ;
260
+ _.rootScope.apply ();
261
+ // Not two-way, did not change.
262
+ expect (_.rootScope.context['name' ]).toEqual ('misko' );
263
+ }));
264
+
265
+ it ('should work with two-way bindings' , async (() {
266
+ _.compile ('<div><io bind-expr="name"></io></div>' );
244
267
245
268
_.rootScope.context['name' ] = 'misko' ;
246
269
microLeap ();
247
270
_.rootScope.apply ();
248
271
var component = _.rootScope.context['ioComponent' ];
249
- expect (component.scope.context['name' ]).toEqual (null );
250
- expect (component.scope.context['attr' ]).toEqual ('A' );
251
272
expect (component.scope.context['expr' ]).toEqual ('misko' );
252
273
component.scope.context['expr' ] = 'angular' ;
253
274
_.rootScope.apply ();
254
275
expect (_.rootScope.context['name' ]).toEqual ('angular' );
255
- expect (_.rootScope.context['done' ]).toEqual (null );
256
- component.scope.context['ondone' ]();
257
- expect (_.rootScope.context['done' ]).toEqual (true );
258
276
}));
259
277
});
260
278
@@ -1139,6 +1157,7 @@ class SometimesComponent {
1139
1157
map: const {
1140
1158
'attr' : '@scope.context.attr' ,
1141
1159
'expr' : '<=>scope.context.expr' ,
1160
+ 'oneway' : '=>scope.context.oneway' ,
1142
1161
'ondone' : '&scope.context.ondone' ,
1143
1162
})
1144
1163
class IoComponent {
0 commit comments