Index: pkg/polymer_expressions/test/bindings_test.dart |
diff --git a/pkg/polymer_expressions/test/bindings_test.dart b/pkg/polymer_expressions/test/bindings_test.dart |
index e8e2f6c7a8a3d382e76aec747e7bd92e87404d07..d5e1063c32ad84bbec298cd5b6e1ed187fe593b8 100644 |
--- a/pkg/polymer_expressions/test/bindings_test.dart |
+++ b/pkg/polymer_expressions/test/bindings_test.dart |
@@ -47,16 +47,15 @@ main() => dirtyCheckZone().run(() { |
'<template><span>{{x}}</span></template>')); |
testDiv.append(template.createInstance(model, new PolymerExpressions())); |
+ var el; |
return new Future(() { |
- var el = testDiv.query("span"); |
+ el = testDiv.query("span"); |
expect(el.text, 'abcde'); |
expect(model.x, 'abcde'); |
model.x = '___'; |
- |
- return new Future(() { |
- expect(model.x, '___'); |
- expect(el.text, '___'); |
- }); |
+ }).then(_nextMicrotask).then((_) { |
+ expect(model.x, '___'); |
+ expect(el.text, '___'); |
}); |
}); |
@@ -69,7 +68,7 @@ main() => dirtyCheckZone().run(() { |
testDiv.append(template.createInstance(model, |
new PolymerExpressions())); |
- return new Future(() {}); |
+ return _nextMicrotask(null); |
}, onError: (e) { |
expect('$e', startsWith("Error evaluating expression 'foo':")); |
completer.complete(true); |
@@ -118,9 +117,32 @@ main() => dirtyCheckZone().run(() { |
subscription.cancel(); |
}); |
}); |
+ |
+ |
+ test('detects changes to ObservableMap keys/values', () { |
+ var map = new ObservableMap.from({'a': 1, 'b': 2}); |
+ var template = templateBind(new Element.html('<template>' |
+ '<template repeat="{{k in x.keys}}">{{k}}:{{x[k]}},</template>' |
+ '</template>')); |
+ var model = new NotifyModel(map); |
+ testDiv.append(template.createInstance(model, new PolymerExpressions())); |
+ |
+ return new Future(() { |
+ expect(testDiv.text, 'a:1,b:2,'); |
+ map.remove('b'); |
+ map['c'] = 3; |
+ }).then(_nextMicrotask).then((_) { |
+ expect(testDiv.text, 'a:1,c:3,'); |
+ map['a'] = 4; |
+ }).then(_nextMicrotask).then((_) { |
+ expect(testDiv.text, 'a:4,c:3,'); |
+ }); |
+ }); |
}); |
}); |
+_nextMicrotask(_) => new Future(() {}); |
+ |
@reflectable |
class NotifyModel extends ChangeNotifier { |
var _x; |