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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 | 7 |
8 import 'package:observe/observe.dart'; | 8 import 'package:observe/observe.dart'; |
9 import 'package:observe/mirrors_used.dart'; // make test smaller. | 9 import 'package:observe/mirrors_used.dart'; // make test smaller. |
10 import 'package:polymer_expressions/polymer_expressions.dart'; | 10 import 'package:polymer_expressions/polymer_expressions.dart'; |
11 import 'package:template_binding/template_binding.dart'; | 11 import 'package:template_binding/template_binding.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
13 import 'package:unittest/html_config.dart'; | 13 import 'package:unittest/html_config.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 useHtmlConfiguration(); | 16 useHtmlConfiguration(); |
17 | 17 |
18 var testDiv; | 18 var testDiv; |
19 group('enumerate', () { | 19 group('enumerate', () { |
20 setUp(() { | 20 setUp(() { |
21 testDiv = new Element.html(''' | 21 testDiv = new Element.html(''' |
22 <div id="test"> | 22 <div id="test"> |
23 <template bind> | 23 <template bind> |
24 <template repeat="{{entry in this | enumerate}}"> | 24 <template repeat="{{entry in this | enumerate}}"> |
25 <div>Item {{ entry.index }} is {{ entry.value }}</div> | 25 <div>Item {{ entry.index }} is {{ entry.value }}</div> |
26 </template> | 26 </template> |
27 </template> | 27 </template> |
28 </div>'''); | 28 </div>'''); |
| 29 TemplateBindExtension.bootstrap(testDiv); |
29 document.body.nodes.add(testDiv); | 30 document.body.nodes.add(testDiv); |
30 }); | 31 }); |
31 | 32 |
32 tearDown(() { | 33 tearDown(() { |
33 nodeBind(testDiv).unbindAll(); | 34 nodeBind(testDiv).unbindAll(); |
34 testDiv.remove(); | 35 testDiv.remove(); |
35 testDiv = null; | 36 testDiv = null; |
36 }); | 37 }); |
37 | 38 |
38 test('should enumerate item and index', () { | 39 test('should enumerate item and index', () { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 'Item 3 is a', | 84 'Item 3 is a', |
84 'Item 4 is b', | 85 'Item 4 is b', |
85 'Item 5 is e', | 86 'Item 5 is e', |
86 'Item 6 is c', | 87 'Item 6 is c', |
87 ]); | 88 ]); |
88 }); | 89 }); |
89 }); | 90 }); |
90 }); | 91 }); |
91 }); | 92 }); |
92 } | 93 } |
OLD | NEW |