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

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

Issue 24096016: PolymerExpressions: fix for null iterators in comprehensions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months 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
« no previous file with comments | « pkg/polymer_expressions/test/eval_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer_expressions/test/syntax_test.dart
diff --git a/pkg/polymer_expressions/test/syntax_test.dart b/pkg/polymer_expressions/test/syntax_test.dart
index 791a02177ea1bdaffc8f1a2c764112142f7c16d4..82c3e60b3402a7146784962474308b3bb939a35f 100644
--- a/pkg/polymer_expressions/test/syntax_test.dart
+++ b/pkg/polymer_expressions/test/syntax_test.dart
@@ -15,19 +15,23 @@ main() {
mdv.initialize();
useHtmlEnhancedConfiguration();
- group('syntax', () {
+ group('PolymerExpressions', () {
+ var testDiv;
+
setUp(() {
- document.body.nodes.add(new Element.html('''
- <template id="test" bind>
- <input id="input" value="{{ firstName }}">
- </template>'''));
+ document.body.append(testDiv = new DivElement());
});
tearDown(() {
- query('#test')..unbindAll()..remove();
+ testDiv.remove();
+ testDiv = null;
});
test('should make two-way bindings to inputs', () {
+ testDiv.nodes.add(new Element.html('''
+ <template id="test" bind>
+ <input id="input" value="{{ firstName }}">
+ </template>'''));
var person = new Person('John', 'Messerly', ['A', 'B', 'C']);
query('#test')
..bindingDelegate = new PolymerExpressions()
@@ -44,6 +48,20 @@ main() {
});
});
+ test('should handle null collections in "in" expressions', () {
+ testDiv.nodes.add(new Element.html('''
+ <template id="test" bind>
+ <template repeat="{{ item in items }}">
+ {{ item }}
+ </template>
+ </template>'''));
+ query('#test')
+ ..bindingDelegate = new PolymerExpressions(globals: {'items': null})
+ ..model = null;
+ // the template should be the only node
+ expect(testDiv.nodes.length, 1);
+ expect(testDiv.nodes[0].id, 'test');
+ });
});
}
« no previous file with comments | « pkg/polymer_expressions/test/eval_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698