Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: pkg/polymer_expressions/test/globals_test.dart

Issue 71353012: Make sure 'enumerate' changes when the underlying collection changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer_expressions/test/globals_test.dart
diff --git a/pkg/polymer_expressions/test/globals_test.dart b/pkg/polymer_expressions/test/globals_test.dart
index 4a7907e020a453775b3faf7951faa8cb89cfc435..295aa111b81efce57068324641bd209e2ad51aec 100644
--- a/pkg/polymer_expressions/test/globals_test.dart
+++ b/pkg/polymer_expressions/test/globals_test.dart
@@ -49,5 +49,43 @@ main() {
'Item 3 is expressions',
]);
}));
+
+ test('should update after changes', wrapMicrotask(() {
+ var model = toObservable(
+ ['hello', 'from', 'polymer', 'expressions', 'a', 'b', 'c']);
+
+ templateBind(testDiv.query('template'))
+ ..bindingDelegate = new PolymerExpressions()
+ ..model = model;
+
+ performMicrotaskCheckpoint();
+
+ expect(testDiv.queryAll('div').map((n) => n.text), [
+ 'Item 0 is hello',
+ 'Item 1 is from',
+ 'Item 2 is polymer',
+ 'Item 3 is expressions',
+ 'Item 4 is a',
+ 'Item 5 is b',
+ 'Item 6 is c',
+ ]);
+
+ model.removeAt(1);
+ model[1] = 'world';
+ model[2] = '!';
+ model.insert(5, 'e');
+
+ performMicrotaskCheckpoint();
+
+ expect(testDiv.queryAll('div').map((n) => n.text), [
+ 'Item 0 is hello',
+ 'Item 1 is world',
+ 'Item 2 is !',
+ 'Item 3 is a',
+ 'Item 4 is b',
+ 'Item 5 is e',
+ 'Item 6 is c',
+ ]);
+ }));
});
}
« pkg/polymer_expressions/lib/src/globals.dart ('K') | « pkg/polymer_expressions/lib/src/globals.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698