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 todomvc.test.mainpage_test; | 5 library todomvc.test.mainpage_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:js' as js; | 9 import 'dart:js' as js; |
10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
11 import 'package:unittest/html_config.dart'; | 11 import 'package:unittest/html_config.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
13 import '../web/elements/td_model.dart'; | 13 import '../web/elements/td_model.dart'; |
14 import '../web/elements/td_todos.dart'; | 14 import '../web/elements/td_todos.dart'; |
15 import 'utils.dart'; | 15 import 'utils.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * This test runs the TodoMVC app and checks the state of the initial page. | 18 * This test runs the TodoMVC app and checks the state of the initial page. |
19 */ | 19 */ |
20 @initMethod | |
21 main() { | 20 main() { |
| 21 initPolymer(); |
22 useHtmlConfiguration(); | 22 useHtmlConfiguration(); |
23 | 23 |
24 setUp(() => Polymer.onReady); | 24 setUp(() => Polymer.onReady); |
25 | 25 |
26 test('initial state', () { | 26 test('initial state', () { |
27 final model = querySelector('td-model'); | 27 final model = querySelector('td-model'); |
28 expect(model is TodoModel, true, reason: 'TodoModel should be created'); | 28 expect(model is TodoModel, true, reason: 'TodoModel should be created'); |
29 | 29 |
30 final app = querySelector('td-todos'); | 30 final app = querySelector('td-todos'); |
31 expect(app is TodoList, true, reason: 'TodoList should be created'); | 31 expect(app is TodoList, true, reason: 'TodoList should be created'); |
(...skipping 17 matching lines...) Expand all Loading... |
49 // Validate a style got applied | 49 // Validate a style got applied |
50 var color = root.querySelector('#footer').getComputedStyle().color; | 50 var color = root.querySelector('#footer').getComputedStyle().color; |
51 expect(color, 'rgb(119, 119, 119)'); | 51 expect(color, 'rgb(119, 119, 119)'); |
52 | 52 |
53 return onPropertyInit(model, 'items').then((_) { | 53 return onPropertyInit(model, 'items').then((_) { |
54 expect(model.items, [], reason: 'no items yet'); | 54 expect(model.items, [], reason: 'no items yet'); |
55 expect(app.model, model, reason: 'model should be data-bound'); | 55 expect(app.model, model, reason: 'model should be data-bound'); |
56 }); | 56 }); |
57 }); | 57 }); |
58 } | 58 } |
OLD | NEW |