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.markdone_test; | 5 library todomvc.test.markdone_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 setUp(() => Polymer.onReady); | 54 setUp(() => Polymer.onReady); |
55 | 55 |
56 test('mark done', () { | 56 test('mark done', () { |
57 appModel.todos.add(new Todo('one (unchecked)')); | 57 appModel.todos.add(new Todo('one (unchecked)')); |
58 appModel.todos.add(new Todo('two (unchecked)')); | 58 appModel.todos.add(new Todo('two (unchecked)')); |
59 appModel.todos.add(new Todo('three (checked)')..done = true); | 59 appModel.todos.add(new Todo('three (checked)')..done = true); |
60 appModel.todos.add(new Todo('four (checked)')); | 60 appModel.todos.add(new Todo('four (checked)')); |
61 | 61 |
62 return new Future(() { | 62 return new Future(() { |
63 var body = query('body'); | 63 var body = querySelector('body'); |
64 | 64 |
65 var label = findWithText(body, 'four (checked)'); | 65 var label = findWithText(body, 'four (checked)'); |
66 expect(label is LabelElement, true, reason: 'text is in a label: $label'); | 66 expect(label is LabelElement, true, reason: 'text is in a label: $label'); |
67 | 67 |
68 var host = findShadowHost(body, label.parentNode); | 68 var host = findShadowHost(body, label.parentNode); |
69 var node = host.parent.query('input'); | 69 var node = host.parent.querySelector('input'); |
70 expect(node is InputElement, true, reason: 'node is a checkbox'); | 70 expect(node is InputElement, true, reason: 'node is a checkbox'); |
71 expect(node.type, 'checkbox', reason: 'node type is checkbox'); | 71 expect(node.type, 'checkbox', reason: 'node type is checkbox'); |
72 expect(node.checked, isFalse, reason: 'element is unchecked'); | 72 expect(node.checked, isFalse, reason: 'element is unchecked'); |
73 | 73 |
74 node.dispatchEvent(new MouseEvent('click', detail: 1)); | 74 node.dispatchEvent(new MouseEvent('click', detail: 1)); |
75 expect(node.checked, true, reason: 'element is checked'); | 75 expect(node.checked, true, reason: 'element is checked'); |
76 }); | 76 }); |
77 }); | 77 }); |
78 } | 78 } |
OLD | NEW |