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

Side by Side Diff: pkg/template_binding/test/template_element_test.dart

Issue 36453002: fix template_binding tests on safari/ie (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/template_binding/test/element_bindings_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library template_binding.test.template_element_test; 5 library template_binding.test.template_element_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 var select = div.nodes[0].nextNode; 1096 var select = div.nodes[0].nextNode;
1097 expect(select.nodes.length, 2); 1097 expect(select.nodes.length, 2);
1098 1098
1099 scheduleMicrotask(expectAsync0(() { 1099 scheduleMicrotask(expectAsync0(() {
1100 scheduleMicrotask(expectAsync0(() { 1100 scheduleMicrotask(expectAsync0(() {
1101 // TODO(jmesserly): this should be called sooner. 1101 // TODO(jmesserly): this should be called sooner.
1102 expect(select.selectedIndex, 1); 1102 expect(select.selectedIndex, 1);
1103 })); 1103 }));
1104 })); 1104 }));
1105 expect(select.nodes[0].tagName, 'TEMPLATE'); 1105 expect(select.nodes[0].tagName, 'TEMPLATE');
1106 expect(templateBind(select.nodes[0]).ref.content.nodes[0].tagName, 1106 expect((templateBind(templateBind(select.nodes[0]).ref)
1107 'OPTGROUP'); 1107 .content.nodes[0] as Element).tagName, 'OPTGROUP');
1108 1108
1109 var optgroup = select.nodes[1]; 1109 var optgroup = select.nodes[1];
1110 expect(optgroup.nodes[0].tagName, 'TEMPLATE'); 1110 expect(optgroup.nodes[0].tagName, 'TEMPLATE');
1111 expect(optgroup.nodes[1].tagName, 'OPTION'); 1111 expect(optgroup.nodes[1].tagName, 'OPTION');
1112 expect(optgroup.nodes[1].text, '0'); 1112 expect(optgroup.nodes[1].text, '0');
1113 expect(optgroup.nodes[2].tagName, 'OPTION'); 1113 expect(optgroup.nodes[2].tagName, 'OPTION');
1114 expect(optgroup.nodes[2].text, '1'); 1114 expect(optgroup.nodes[2].text, '1');
1115 }); 1115 });
1116 1116
1117 observeTest('NestedIterateTableMixedSemanticNative', () { 1117 observeTest('NestedIterateTableMixedSemanticNative', () {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 expect(div.nodes[4].text, 'b:1'); 1493 expect(div.nodes[4].text, 'b:1');
1494 expect(div.nodes[6].text, 'b:2'); 1494 expect(div.nodes[6].text, 'b:2');
1495 }); 1495 });
1496 1496
1497 observeTest('Content', () { 1497 observeTest('Content', () {
1498 var div = createTestHtml( 1498 var div = createTestHtml(
1499 '<template><a></a></template>' 1499 '<template><a></a></template>'
1500 '<template><b></b></template>'); 1500 '<template><b></b></template>');
1501 var templateA = div.nodes.first; 1501 var templateA = div.nodes.first;
1502 var templateB = div.nodes.last; 1502 var templateB = div.nodes.last;
1503 var contentA = templateA.content; 1503 var contentA = templateBind(templateA).content;
1504 var contentB = templateB.content; 1504 var contentB = templateBind(templateB).content;
1505 expect(contentA, isNotNull); 1505 expect(contentA, isNotNull);
1506 1506
1507 expect(templateA.ownerDocument, isNot(equals(contentA.ownerDocument))); 1507 expect(templateA.ownerDocument, isNot(equals(contentA.ownerDocument)));
1508 expect(templateB.ownerDocument, isNot(equals(contentB.ownerDocument))); 1508 expect(templateB.ownerDocument, isNot(equals(contentB.ownerDocument)));
1509 1509
1510 expect(templateB.ownerDocument, templateA.ownerDocument); 1510 expect(templateB.ownerDocument, templateA.ownerDocument);
1511 expect(contentB.ownerDocument, contentA.ownerDocument); 1511 expect(contentB.ownerDocument, contentA.ownerDocument);
1512 1512
1513 expect(templateA.ownerDocument.window, window); 1513 expect(templateA.ownerDocument.window, window);
1514 expect(templateB.ownerDocument.window, window); 1514 expect(templateB.ownerDocument.window, window);
1515 1515
1516 expect(contentA.ownerDocument.window, null); 1516 expect(contentA.ownerDocument.window, null);
1517 expect(contentB.ownerDocument.window, null); 1517 expect(contentB.ownerDocument.window, null);
1518 1518
1519 expect(contentA.nodes.last, contentA.nodes.first); 1519 expect(contentA.nodes.last, contentA.nodes.first);
1520 expect(contentA.nodes.first.tagName, 'A'); 1520 expect(contentA.nodes.first.tagName, 'A');
1521 1521
1522 expect(contentB.nodes.last, contentB.nodes.first); 1522 expect(contentB.nodes.last, contentB.nodes.first);
1523 expect(contentB.nodes.first.tagName, 'B'); 1523 expect(contentB.nodes.first.tagName, 'B');
1524 }); 1524 });
1525 1525
1526 observeTest('NestedContent', () { 1526 observeTest('NestedContent', () {
1527 var div = createTestHtml( 1527 var div = createTestHtml(
1528 '<template>' 1528 '<template>'
1529 '<template></template>' 1529 '<template></template>'
1530 '</template>'); 1530 '</template>');
1531 var templateA = div.nodes.first; 1531 var templateA = div.nodes.first;
1532 var templateB = templateA.content.nodes.first; 1532 var templateB = templateBind(templateA).content.nodes.first;
1533 1533
1534 expect(templateB.ownerDocument, templateA.content.ownerDocument); 1534 expect(templateB.ownerDocument, templateBind(templateA)
1535 expect(templateB.content.ownerDocument, templateA.content.ownerDocument); 1535 .content.ownerDocument);
1536 expect(templateBind(templateB).content.ownerDocument,
1537 templateBind(templateA).content.ownerDocument);
1536 }); 1538 });
1537 1539
1538 observeTest('BindShadowDOM', () { 1540 observeTest('BindShadowDOM', () {
1539 if (ShadowRoot.supported) { 1541 if (ShadowRoot.supported) {
1540 var root = createShadowTestHtml( 1542 var root = createShadowTestHtml(
1541 '<template bind="{{}}">Hi {{ name }}</template>'); 1543 '<template bind="{{}}">Hi {{ name }}</template>');
1542 var model = toObservable({'name': 'Leela'}); 1544 var model = toObservable({'name': 'Leela'});
1543 recursivelySetTemplateModel(root, model); 1545 recursivelySetTemplateModel(root, model);
1544 deliverChanges(model); 1546 deliverChanges(model);
1545 expect(root.nodes[1].text, 'Hi Leela'); 1547 expect(root.nodes[1].text, 'Hi Leela');
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 template = new Element.tag('template'); 1661 template = new Element.tag('template');
1660 template.innerHtml = 1662 template.innerHtml =
1661 '<template>' 1663 '<template>'
1662 '<div></div>' 1664 '<div></div>'
1663 '<template>' 1665 '<template>'
1664 'Hello' 1666 'Hello'
1665 '</template>' 1667 '</template>'
1666 '</template>'; 1668 '</template>';
1667 1669
1668 TemplateBindExtension.bootstrap(template); 1670 TemplateBindExtension.bootstrap(template);
1669 template2 = template.content.nodes.first; 1671 template2 = templateBind(templateBind(template).content.nodes.first);
1670 expect(template2.content.nodes.length, 2); 1672 expect(template2.content.nodes.length, 2);
1671 var template3 = template2.content.nodes.first.nextNode; 1673 var template3 = templateBind(template2.content.nodes.first.nextNode);
1672 expect(template3.content.nodes.length, 1); 1674 expect(template3.content.nodes.length, 1);
1673 expect(template3.content.nodes.first.text, 'Hello'); 1675 expect(template3.content.nodes.first.text, 'Hello');
1674 }); 1676 });
1675 } 1677 }
1676 1678
1677 class TestBindingSyntax extends BindingDelegate { 1679 class TestBindingSyntax extends BindingDelegate {
1678 getBinding(model, String path, name, node) { 1680 getBinding(model, String path, name, node) {
1679 if (path.trim() == 'replaceme') return new ObservableBox('replaced'); 1681 if (path.trim() == 'replaceme') return new ObservableBox('replaced');
1680 return null; 1682 return null;
1681 } 1683 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 k = k is String ? new Symbol(k) : _deepToSymbol(k); 1732 k = k is String ? new Symbol(k) : _deepToSymbol(k);
1731 result[k] = _deepToSymbol(v); 1733 result[k] = _deepToSymbol(v);
1732 }); 1734 });
1733 return result; 1735 return result;
1734 } 1736 }
1735 if (value is Iterable) { 1737 if (value is Iterable) {
1736 return value.map(_deepToSymbol).toList(); 1738 return value.map(_deepToSymbol).toList();
1737 } 1739 }
1738 return value; 1740 return value;
1739 } 1741 }
OLDNEW
« no previous file with comments | « pkg/template_binding/test/element_bindings_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698