| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
| 5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <html lang="en"> | 7 <html lang="en"> |
| 8 <head> | 8 <head> |
| 9 <!-- | 9 <!-- |
| 10 This test runs the TodoMVC app, adds a few todos, marks some as done | 10 This test runs the TodoMVC app, adds a few todos, marks some as done |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 main() { | 62 main() { |
| 63 mdv.initialize(); | 63 mdv.initialize(); |
| 64 | 64 |
| 65 Timer.run(() { | 65 Timer.run(() { |
| 66 appModel.todos.add(new Todo('one (unchecked)')); | 66 appModel.todos.add(new Todo('one (unchecked)')); |
| 67 appModel.todos.add(new Todo('two (unchecked)')); | 67 appModel.todos.add(new Todo('two (unchecked)')); |
| 68 appModel.todos.add(new Todo('three (checked)')..done = true); | 68 appModel.todos.add(new Todo('three (checked)')..done = true); |
| 69 appModel.todos.add(new Todo('four (checked)')); | 69 appModel.todos.add(new Todo('four (checked)')); |
| 70 deliverChangeRecords(); | 70 |
| 71 // TODO(sigmund): investigate why is not enough to do Timer.run | 71 // TODO(sigmund): investigate why is not enough to do Timer.run |
| 72 new Timer(new Duration(milliseconds: 200), () { | 72 new Timer(new Duration(milliseconds: 200), () { |
| 73 // Note: use query because "document" is unwrapped in ShadowDOM polyfill. | 73 // Note: use query because "document" is unwrapped in ShadowDOM polyfill. |
| 74 var body = query('body'); | 74 var body = query('body'); |
| 75 | 75 |
| 76 var label = findWithText(body, 'four (checked)'); | 76 var label = findWithText(body, 'four (checked)'); |
| 77 expect(label is LabelElement, isTrue, reason: 'text is in a label'); | 77 expect(label is LabelElement, isTrue, reason: 'text is in a label'); |
| 78 | 78 |
| 79 var host = findShadowHost(body, label.parentNode); | 79 var host = findShadowHost(body, label.parentNode); |
| 80 var node = host.parent.query('input'); | 80 var node = host.parent.query('input'); |
| 81 expect(node is InputElement, isTrue, reason: 'node is a checkbox'); | 81 expect(node is InputElement, isTrue, reason: 'node is a checkbox'); |
| 82 expect(node.type, 'checkbox', reason: 'node type is checkbox'); | 82 expect(node.type, 'checkbox', reason: 'node type is checkbox'); |
| 83 expect(node.checked, isFalse, reason: 'element is unchecked'); | 83 expect(node.checked, isFalse, reason: 'element is unchecked'); |
| 84 | 84 |
| 85 node.dispatchEvent(new MouseEvent('click', detail: 1)); | 85 node.dispatchEvent(new MouseEvent('click', detail: 1)); |
| 86 expect(node.checked, isTrue, reason: 'element is checked'); | 86 expect(node.checked, isTrue, reason: 'element is checked'); |
| 87 | 87 |
| 88 Timer.run(() { | 88 Timer.run(() { |
| 89 window.postMessage('done', '*'); | 89 window.postMessage('done', '*'); |
| 90 }); | 90 }); |
| 91 }); | 91 }); |
| 92 }); | 92 }); |
| 93 } | 93 } |
| 94 |
| 94 </script> | 95 </script> |
| 95 </body> | 96 </body> |
| 96 </html> | 97 </html> |
| OLD | NEW |