| 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 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 if (ShadowRoot.supported) { | 1313 if (ShadowRoot.supported) { |
| 1314 var root = createShadowTestHtml( | 1314 var root = createShadowTestHtml( |
| 1315 '<template bind="{{}}">Hi {{ name }}</template>'); | 1315 '<template bind="{{}}">Hi {{ name }}</template>'); |
| 1316 var model = toSymbolMap({'name': 'Leela'}); | 1316 var model = toSymbolMap({'name': 'Leela'}); |
| 1317 recursivelySetTemplateModel(root, model); | 1317 recursivelySetTemplateModel(root, model); |
| 1318 deliverChanges(model); | 1318 deliverChanges(model); |
| 1319 expect(root.nodes[1].text, 'Hi Leela'); | 1319 expect(root.nodes[1].text, 'Hi Leela'); |
| 1320 } | 1320 } |
| 1321 }); | 1321 }); |
| 1322 | 1322 |
| 1323 test('BindShadowDOM bindModel', () { |
| 1324 if (ShadowRoot.supported) { |
| 1325 var root = createShadowTestHtml('Hi {{ name }}'); |
| 1326 var model = toSymbolMap({'name': 'Leela'}); |
| 1327 TemplateElement.bindModel(root, model); |
| 1328 deliverChangeRecords(); |
| 1329 expect(root.text, 'Hi Leela'); |
| 1330 } |
| 1331 }); |
| 1332 |
| 1333 test('bindModel to polyfilled shadow root', () { |
| 1334 var root = createTestHtml('Hi {{ name }}'); |
| 1335 var model = toSymbolMap({'name': 'Leela'}); |
| 1336 TemplateElement.bindModel(root, model); |
| 1337 deliverChangeRecords(); |
| 1338 expect(root.text, 'Hi Leela'); |
| 1339 }); |
| 1340 |
| 1323 // https://github.com/toolkitchen/mdv/issues/8 | 1341 // https://github.com/toolkitchen/mdv/issues/8 |
| 1324 test('UnbindingInNestedBind', () { | 1342 test('UnbindingInNestedBind', () { |
| 1325 var div = createTestHtml( | 1343 var div = createTestHtml( |
| 1326 '<template bind="{{outer}}" if="{{outer}}" syntax="testHelper">' | 1344 '<template bind="{{outer}}" if="{{outer}}" syntax="testHelper">' |
| 1327 '<template bind="{{inner}}" if="{{inner}}">' | 1345 '<template bind="{{inner}}" if="{{inner}}">' |
| 1328 '{{ age }}' | 1346 '{{ age }}' |
| 1329 '</template>' | 1347 '</template>' |
| 1330 '</template>'); | 1348 '</template>'); |
| 1331 | 1349 |
| 1332 var syntax = new UnbindingInNestedBindSyntax(); | 1350 var syntax = new UnbindingInNestedBindSyntax(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 result[k] = _deepToSymbol(v); | 1512 result[k] = _deepToSymbol(v); |
| 1495 }); | 1513 }); |
| 1496 return result; | 1514 return result; |
| 1497 } | 1515 } |
| 1498 if (value is Iterable) { | 1516 if (value is Iterable) { |
| 1499 return value.map(_deepToSymbol).toList(); | 1517 return value.map(_deepToSymbol).toList(); |
| 1500 } | 1518 } |
| 1501 return value; | 1519 return value; |
| 1502 } | 1520 } |
| 1503 | 1521 |
| OLD | NEW |