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

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

Issue 17706003: update MDV impl (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 6 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/bindings.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | 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 4b47b34dcd8cf792af1578cfe54d2a5ef3899f17..3602db0c8fa7708d427daeda27728bf7061f85f3 100644
--- a/pkg/mdv/test/template_element_test.dart
+++ b/pkg/mdv/test/template_element_test.dart
@@ -81,6 +81,31 @@ templateElementTests() {
expect(div.nodes.last.text, 'text');
});
+ test('Template bind, no parent', () {
+ var div = createTestHtml('<template bind>text</template>');
+ var template = div.nodes[0];
+ template.remove();
+
+ recursivelySetTemplateModel(template, toSymbolMap({}));
+ deliverChangeRecords();
+ expect(template.nodes.length, 0);
+ expect(template.nextNode, null);
+ // TODO(jmesserly): the JS tests assert that observer callbacks had no
+ // exceptions. How do we replicate this?
+ });
+
+ test('Template bind, no defaultView', () {
+ var div = createTestHtml('<template bind>text</template>');
+ var template = div.nodes[0];
+ var doc = document.implementation.createHtmlDocument('');
+ doc.adoptNode(div);
+ recursivelySetTemplateModel(template, toSymbolMap({}));
+ deliverChangeRecords();
+ expect(div.nodes.length, 1);
+ // TODO(jmesserly): the JS tests assert that observer callbacks had no
+ // exceptions. How do we replicate this?
+ });
+
test('Template-Empty Bind', () {
var div = createTestHtml('<template bind>text</template>');
recursivelySetTemplateModel(div, null);
@@ -945,6 +970,29 @@ templateElementTests() {
expect(div.nodes[i++].text, 'Item 2');
});
+ test('Attribute Template Option', () {
+ var div = createTestHtml(
+ '<template bind>'
+ '<select>'
+ '<option template repeat>{{ val }}</option>'
+ '</select>'
+ '</template>');
+
+ var m = toSymbols([{ 'val': 0 }, { 'val': 1 }]);
+
+ recursivelySetTemplateModel(div, m);
+ deliverChanges(m);
+
+ var select = div.nodes[0].nextNode;
+ expect(select.nodes.length, 3);
+ expect(select.nodes[0].tagName, 'TEMPLATE');
+ expect(select.nodes[0].ref.content.nodes[0].tagName, 'OPTION');
+ expect(select.nodes[1].tagName, 'OPTION');
+ expect(select.nodes[1].text, '0');
+ expect(select.nodes[2].tagName, 'OPTION');
+ expect(select.nodes[2].text, '1');
+ });
+
test('NestedIterateTableMixedSemanticNative', () {
if (!TemplateElement.supported) return;
« no previous file with comments | « pkg/mdv/lib/src/bindings.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698