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

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

Issue 22253002: fix packages for latest SDK changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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_element_test; 5 library 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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 TemplateElement.bootstrap(template); 1687 TemplateElement.bootstrap(template);
1688 template2 = template.content.nodes.first; 1688 template2 = template.content.nodes.first;
1689 expect(template2.content.nodes.length, 2); 1689 expect(template2.content.nodes.length, 2);
1690 var template3 = template2.content.nodes.first.nextNode; 1690 var template3 = template2.content.nodes.first.nextNode;
1691 expect(template3.content.nodes.length, 1); 1691 expect(template3.content.nodes.length, 1);
1692 expect(template3.content.nodes.first.text, 'Hello'); 1692 expect(template3.content.nodes.first.text, 'Hello');
1693 }); 1693 });
1694 1694
1695 observeTest('instanceCreated hack', () { 1695 observeTest('instanceCreated hack', () {
1696 var called = false; 1696 var called = false;
1697 var sub = mdv.instanceCreated.listen((node) { 1697
1698 callback(node) {
1698 called = true; 1699 called = true;
1699 expect(node.nodeType, Node.DOCUMENT_FRAGMENT_NODE); 1700 expect(node.nodeType, Node.DOCUMENT_FRAGMENT_NODE);
1700 }); 1701 }
1702 mdv.instanceCreated.add(callback);
1701 1703
1702 var div = createTestHtml('<template bind="{{}}">Foo</template>'); 1704 var div = createTestHtml('<template bind="{{}}">Foo</template>');
1703 expect(called, false); 1705 expect(called, false);
1704 1706
1705 recursivelySetTemplateModel(div, null); 1707 recursivelySetTemplateModel(div, null);
1706 performMicrotaskCheckpoint(); 1708 performMicrotaskCheckpoint();
1707 expect(called, true); 1709 expect(called, true);
1708 1710
1709 sub.cancel(); 1711 mdv.instanceCreated.remove(callback);
1710 }); 1712 });
1711 } 1713 }
1712 1714
1713 class TestBindingSyntax extends BindingDelegate { 1715 class TestBindingSyntax extends BindingDelegate {
1714 getBinding(model, String path, name, node) { 1716 getBinding(model, String path, name, node) {
1715 if (path.trim() == 'replaceme') return new ObservableBox('replaced'); 1717 if (path.trim() == 'replaceme') return new ObservableBox('replaced');
1716 return null; 1718 return null;
1717 } 1719 }
1718 } 1720 }
1719 1721
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 k = k is String ? sym(k) : _deepToSymbol(k); 1772 k = k is String ? sym(k) : _deepToSymbol(k);
1771 result[k] = _deepToSymbol(v); 1773 result[k] = _deepToSymbol(v);
1772 }); 1774 });
1773 return result; 1775 return result;
1774 } 1776 }
1775 if (value is Iterable) { 1777 if (value is Iterable) {
1776 return value.map(_deepToSymbol).toList(); 1778 return value.map(_deepToSymbol).toList();
1777 } 1779 }
1778 return value; 1780 return value;
1779 } 1781 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698