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

Unified Diff: pkg/mdv/test/template_element_test.dart

Issue 19744006: Ensure model is passed with <template if> (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add comment Created 7 years, 5 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/mdv/lib/src/template_iterator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mdv/test/template_element_test.dart
diff --git a/pkg/mdv/test/template_element_test.dart b/pkg/mdv/test/template_element_test.dart
index e69ab3a5f77e2dfe69dbdbe5b3cd063987ce3d38..b592cb59cc73b5b392a8bf3de0197aa39e5c27c7 100644
--- a/pkg/mdv/test/template_element_test.dart
+++ b/pkg/mdv/test/template_element_test.dart
@@ -146,10 +146,10 @@ templateElementTests() {
});
observeTest('Template If', () {
- var div = createTestHtml('<template if="{{ foo }}">text</template>');
+ var div = createTestHtml('<template if="{{ foo }}">{{ value }}</template>');
// Note: changed this value from 0->null because zero is not falsey in Dart.
// See https://code.google.com/p/dart/issues/detail?id=11956
- var m = toSymbolMap({ 'foo': null });
+ var m = toSymbolMap({ 'foo': null, 'value': 'foo' });
recursivelySetTemplateModel(div, m);
performMicrotaskCheckpoint();
expect(div.nodes.length, 1);
@@ -157,7 +157,25 @@ templateElementTests() {
m[sym('foo')] = 1;
performMicrotaskCheckpoint();
expect(div.nodes.length, 2);
- expect(div.lastChild.text, 'text');
+ expect(div.lastChild.text, 'foo');
+ });
+
+ observeTest('Template Repeat If', () {
+ var div = createTestHtml(
+ '<template repeat="{{ foo }}" if="{{ bar }}">{{ }}</template>');
+ // Note: changed this value from 0->null because zero is not falsey in Dart.
+ // See https://code.google.com/p/dart/issues/detail?id=11956
+ var m = toSymbolMap({ 'bar': null, 'foo': [1, 2, 3] });
+ recursivelySetTemplateModel(div, m);
+ performMicrotaskCheckpoint();
+ expect(div.nodes.length, 1);
+
+ m[sym('bar')] = 1;
+ performMicrotaskCheckpoint();
+ expect(div.nodes.length, 4);
+ expect(div.nodes[1].text, '1');
+ expect(div.nodes[2].text, '2');
+ expect(div.nodes[3].text, '3');
});
observeTest('TextTemplateWithNullStringBinding', () {
« no previous file with comments | « pkg/mdv/lib/src/template_iterator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698