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'; |
(...skipping 20 matching lines...) Expand all Loading... |
31 expect(app is TodoList, true, reason: 'TodoList should be created'); | 31 expect(app is TodoList, true, reason: 'TodoList should be created'); |
32 | 32 |
33 final root = app.shadowRoot; | 33 final root = app.shadowRoot; |
34 final newTodo = root.querySelector('#new-todo'); | 34 final newTodo = root.querySelector('#new-todo'); |
35 expect(newTodo.placeholder, "What needs to be done?"); | 35 expect(newTodo.placeholder, "What needs to be done?"); |
36 | 36 |
37 expect(app.modelId, 'model', reason: 'modelId is set via attribute'); | 37 expect(app.modelId, 'model', reason: 'modelId is set via attribute'); |
38 | 38 |
39 // Validate the stylesheet was loaded | 39 // Validate the stylesheet was loaded |
40 if (js.context.hasProperty('ShadowDOMPolyfill')) { | 40 if (js.context.hasProperty('ShadowDOMPolyfill')) { |
41 final style = document.head.querySelector('style[ShadowCSSShim]'); | 41 final style = document.head.querySelector('style[shim-shadowdom-css]'); |
42 expect(style.text, contains('\ntd-todos #todoapp {')); | 42 expect(style.text, contains('\ntd-todos #todoapp {')); |
43 } else { | 43 } else { |
44 final style = root.querySelector('style'); | 44 final style = root.querySelector('style'); |
45 expect(style, isNotNull, reason: '<link> was replaced with <style>'); | 45 expect(style, isNotNull, reason: '<link> was replaced with <style>'); |
46 expect(style.text, contains('\n#todoapp {')); | 46 expect(style.text, contains('\n#todoapp {')); |
47 } | 47 } |
48 | 48 |
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 |