Index: example/todomvc/test/todomvc_markdone_test.html |
diff --git a/example/todomvc/test/todomvc_markdone_test.html b/example/todomvc/test/todomvc_markdone_test.html |
index 304a279c5253eef444b110e674d270a1472d0568..3219312d63afb3aa01adcb50e2dc81dc558ca246 100644 |
--- a/example/todomvc/test/todomvc_markdone_test.html |
+++ b/example/todomvc/test/todomvc_markdone_test.html |
@@ -19,10 +19,7 @@ programatically, and clicks on a checkbox to mark others via the UI. |
</head><body> |
<todo-app></todo-app> |
<script type="application/dart"> |
-import 'dart:async'; |
import 'dart:html'; |
-import 'package:mdv/mdv.dart' as mdv; |
-import 'package:observe/observe.dart'; |
import 'package:unittest/unittest.dart'; |
import 'package:polymer/polymer.dart'; |
import '../web/model.dart'; |
@@ -60,36 +57,28 @@ Node findShadowHost(Node node, ShadowRoot root) { |
} |
main() { |
- mdv.initialize(); |
+ appModel.todos.add(new Todo('one (unchecked)')); |
+ appModel.todos.add(new Todo('two (unchecked)')); |
+ appModel.todos.add(new Todo('three (checked)')..done = true); |
+ appModel.todos.add(new Todo('four (checked)')); |
- Timer.run(() { |
- appModel.todos.add(new Todo('one (unchecked)')); |
- appModel.todos.add(new Todo('two (unchecked)')); |
- appModel.todos.add(new Todo('three (checked)')..done = true); |
- appModel.todos.add(new Todo('four (checked)')); |
+ performMicrotaskCheckpoint(); |
+ var body = query('body'); |
- // TODO(sigmund): investigate why is not enough to do Timer.run |
- new Timer(new Duration(milliseconds: 200), () { |
- // Note: use query because "document" is unwrapped in ShadowDOM polyfill. |
- var body = query('body'); |
+ var label = findWithText(body, 'four (checked)'); |
+ expect(label is LabelElement, isTrue, reason: 'text is in a label'); |
- var label = findWithText(body, 'four (checked)'); |
- expect(label is LabelElement, isTrue, reason: 'text is in a label'); |
+ var host = findShadowHost(body, label.parentNode); |
+ var node = host.parent.query('input'); |
+ expect(node is InputElement, isTrue, reason: 'node is a checkbox'); |
+ expect(node.type, 'checkbox', reason: 'node type is checkbox'); |
+ expect(node.checked, isFalse, reason: 'element is unchecked'); |
- var host = findShadowHost(body, label.parentNode); |
- var node = host.parent.query('input'); |
- expect(node is InputElement, isTrue, reason: 'node is a checkbox'); |
- expect(node.type, 'checkbox', reason: 'node type is checkbox'); |
- expect(node.checked, isFalse, reason: 'element is unchecked'); |
+ node.dispatchEvent(new MouseEvent('click', detail: 1)); |
+ expect(node.checked, isTrue, reason: 'element is checked'); |
+ performMicrotaskCheckpoint(); |
- node.dispatchEvent(new MouseEvent('click', detail: 1)); |
- expect(node.checked, isTrue, reason: 'element is checked'); |
- |
- Timer.run(() { |
- window.postMessage('done', '*'); |
- }); |
- }); |
- }); |
+ window.postMessage('done', '*'); |
} |
</script> |