Skip to content

Commit 665e121

Browse files
committed
test(compiler): Break the bind- tests into smaller tests
1 parent db70e70 commit 665e121

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

test/core_dom/compiler_spec.dart

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,40 @@ void main() {
239239
expect(element.text).toEqual('angular');
240240
});
241241

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>');
244267

245268
_.rootScope.context['name'] = 'misko';
246269
microLeap();
247270
_.rootScope.apply();
248271
var component = _.rootScope.context['ioComponent'];
249-
expect(component.scope.context['name']).toEqual(null);
250-
expect(component.scope.context['attr']).toEqual('A');
251272
expect(component.scope.context['expr']).toEqual('misko');
252273
component.scope.context['expr'] = 'angular';
253274
_.rootScope.apply();
254275
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);
258276
}));
259277
});
260278

@@ -1139,6 +1157,7 @@ class SometimesComponent {
11391157
map: const {
11401158
'attr': '@scope.context.attr',
11411159
'expr': '<=>scope.context.expr',
1160+
'oneway': '=>scope.context.oneway',
11421161
'ondone': '&scope.context.ondone',
11431162
})
11441163
class IoComponent {

0 commit comments

Comments
 (0)