| OLD | NEW |
| 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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 if (ShadowRoot.supported) { | 1559 if (ShadowRoot.supported) { |
| 1560 var root = createShadowTestHtml( | 1560 var root = createShadowTestHtml( |
| 1561 '<template bind="{{}}">Hi {{ name }}</template>'); | 1561 '<template bind="{{}}">Hi {{ name }}</template>'); |
| 1562 var model = toSymbolMap({'name': 'Leela'}); | 1562 var model = toSymbolMap({'name': 'Leela'}); |
| 1563 recursivelySetTemplateModel(root, model); | 1563 recursivelySetTemplateModel(root, model); |
| 1564 deliverChanges(model); | 1564 deliverChanges(model); |
| 1565 expect(root.nodes[1].text, 'Hi Leela'); | 1565 expect(root.nodes[1].text, 'Hi Leela'); |
| 1566 } | 1566 } |
| 1567 }); | 1567 }); |
| 1568 | 1568 |
| 1569 observeTest('BindShadowDOM bindModel', () { | 1569 observeTest('BindShadowDOM createInstance', () { |
| 1570 if (ShadowRoot.supported) { | 1570 if (ShadowRoot.supported) { |
| 1571 var root = createShadowTestHtml('Hi {{ name }}'); | |
| 1572 var model = toSymbolMap({'name': 'Leela'}); | 1571 var model = toSymbolMap({'name': 'Leela'}); |
| 1573 mdv.bindModel(root, model); | 1572 var template = new Element.html('<template>Hi {{ name }}</template>'); |
| 1573 var root = createShadowTestHtml(''); |
| 1574 root.nodes.add(template.createInstance(model)); |
| 1575 |
| 1574 performMicrotaskCheckpoint(); | 1576 performMicrotaskCheckpoint(); |
| 1575 expect(root.text, 'Hi Leela'); | 1577 expect(root.text, 'Hi Leela'); |
| 1578 |
| 1579 model[sym('name')] = 'Fry'; |
| 1580 performMicrotaskCheckpoint(); |
| 1581 expect(root.text, 'Hi Fry'); |
| 1576 } | 1582 } |
| 1577 }); | 1583 }); |
| 1578 | 1584 |
| 1579 observeTest('bindModel to polyfilled shadow root', () { | |
| 1580 var root = createTestHtml('Hi {{ name }}'); | |
| 1581 var model = toSymbolMap({'name': 'Leela'}); | |
| 1582 mdv.bindModel(root, model); | |
| 1583 performMicrotaskCheckpoint(); | |
| 1584 expect(root.text, 'Hi Leela'); | |
| 1585 }); | |
| 1586 | |
| 1587 observeTest('BindShadowDOM Template Ref', () { | 1585 observeTest('BindShadowDOM Template Ref', () { |
| 1588 if (ShadowRoot.supported) { | 1586 if (ShadowRoot.supported) { |
| 1589 var root = createShadowTestHtml( | 1587 var root = createShadowTestHtml( |
| 1590 '<template id=foo>Hi</template><template bind ref=foo></template>'); | 1588 '<template id=foo>Hi</template><template bind ref=foo></template>'); |
| 1591 recursivelySetTemplateModel(root, toSymbolMap({})); | 1589 recursivelySetTemplateModel(root, toSymbolMap({})); |
| 1592 performMicrotaskCheckpoint(); | 1590 performMicrotaskCheckpoint(); |
| 1593 expect(root.nodes.length, 3); | 1591 expect(root.nodes.length, 3); |
| 1594 } | 1592 } |
| 1595 }); | 1593 }); |
| 1596 | 1594 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 k = k is String ? sym(k) : _deepToSymbol(k); | 1770 k = k is String ? sym(k) : _deepToSymbol(k); |
| 1773 result[k] = _deepToSymbol(v); | 1771 result[k] = _deepToSymbol(v); |
| 1774 }); | 1772 }); |
| 1775 return result; | 1773 return result; |
| 1776 } | 1774 } |
| 1777 if (value is Iterable) { | 1775 if (value is Iterable) { |
| 1778 return value.map(_deepToSymbol).toList(); | 1776 return value.map(_deepToSymbol).toList(); |
| 1779 } | 1777 } |
| 1780 return value; | 1778 return value; |
| 1781 } | 1779 } |
| OLD | NEW |