| 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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 deliverChanges(m); | 1342 deliverChanges(m); |
| 1343 expect(div.nodes.length, 7); | 1343 expect(div.nodes.length, 7); |
| 1344 expect(div.nodes[5].text, 'Name: Leela'); | 1344 expect(div.nodes[5].text, 'Name: Leela'); |
| 1345 | 1345 |
| 1346 m[sym('friend')] = toSymbols({'name': 'Leela'}); | 1346 m[sym('friend')] = toSymbols({'name': 'Leela'}); |
| 1347 deliverChanges(m); | 1347 deliverChanges(m); |
| 1348 expect(div.nodes.length, 5); | 1348 expect(div.nodes.length, 5); |
| 1349 expect(div.nodes[3].text, 'Name: Leela'); | 1349 expect(div.nodes[3].text, 'Name: Leela'); |
| 1350 }); | 1350 }); |
| 1351 | 1351 |
| 1352 observeTest('Template - Self is terminator', () { |
| 1353 var div = createTestHtml( |
| 1354 '<template repeat>{{ foo }}' |
| 1355 '<template bind></template>' |
| 1356 '</template>'); |
| 1357 |
| 1358 var m = toSymbols([{ 'foo': 'bar' }]); |
| 1359 recursivelySetTemplateModel(div, m); |
| 1360 performMicrotaskCheckpoint(); |
| 1361 |
| 1362 m.add(toSymbols({ 'foo': 'baz' })); |
| 1363 recursivelySetTemplateModel(div, m); |
| 1364 performMicrotaskCheckpoint(); |
| 1365 |
| 1366 expect(div.nodes.length, 5); |
| 1367 expect(div.nodes[1].text, 'bar'); |
| 1368 expect(div.nodes[3].text, 'baz'); |
| 1369 }); |
| 1370 |
| 1352 observeTest('RecursiveRef', () { | 1371 observeTest('RecursiveRef', () { |
| 1353 var div = createTestHtml( | 1372 var div = createTestHtml( |
| 1354 '<template bind>' | 1373 '<template bind>' |
| 1355 '<template id=src>{{ foo }}</template>' | 1374 '<template id=src>{{ foo }}</template>' |
| 1356 '<template bind ref=src></template>' | 1375 '<template bind ref=src></template>' |
| 1357 '</template>'); | 1376 '</template>'); |
| 1358 | 1377 |
| 1359 var m = toSymbols({'foo': 'bar'}); | 1378 var m = toSymbols({'foo': 'bar'}); |
| 1360 recursivelySetTemplateModel(div, m); | 1379 recursivelySetTemplateModel(div, m); |
| 1361 performMicrotaskCheckpoint(); | 1380 performMicrotaskCheckpoint(); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 k = k is String ? sym(k) : _deepToSymbol(k); | 1716 k = k is String ? sym(k) : _deepToSymbol(k); |
| 1698 result[k] = _deepToSymbol(v); | 1717 result[k] = _deepToSymbol(v); |
| 1699 }); | 1718 }); |
| 1700 return result; | 1719 return result; |
| 1701 } | 1720 } |
| 1702 if (value is Iterable) { | 1721 if (value is Iterable) { |
| 1703 return value.map(_deepToSymbol).toList(); | 1722 return value.map(_deepToSymbol).toList(); |
| 1704 } | 1723 } |
| 1705 return value; | 1724 return value; |
| 1706 } | 1725 } |
| OLD | NEW |