Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: samples/third_party/todomvc/test/markdone_test.dart

Issue 29823005: fixes to polymer, gets tests back to a stable state (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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:html'; 7 import 'dart:html';
8 import 'package:polymer/platform.dart' show endOfMicrotask;
8 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
9 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart'; 11 import 'package:unittest/html_config.dart';
11 import '../web/model.dart'; 12 import '../web/model.dart';
12 13
13 Node findWithText(Node node, String text) { 14 Node findWithText(Node node, String text) {
14 if (node.text == text) return node; 15 if (node.text == text) return node;
15 if (node is Element && (node as Element).localName == 'polymer-element') { 16 if (node is Element && (node as Element).localName == 'polymer-element') {
16 return null; 17 return null;
17 } 18 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 useHtmlConfiguration(); 51 useHtmlConfiguration();
51 52
52 setUp(() => Polymer.onReady); 53 setUp(() => Polymer.onReady);
53 54
54 test('mark done', () { 55 test('mark done', () {
55 appModel.todos.add(new Todo('one (unchecked)')); 56 appModel.todos.add(new Todo('one (unchecked)'));
56 appModel.todos.add(new Todo('two (unchecked)')); 57 appModel.todos.add(new Todo('two (unchecked)'));
57 appModel.todos.add(new Todo('three (checked)')..done = true); 58 appModel.todos.add(new Todo('three (checked)')..done = true);
58 appModel.todos.add(new Todo('four (checked)')); 59 appModel.todos.add(new Todo('four (checked)'));
59 60
60 performMicrotaskCheckpoint(); 61 endOfMicrotask(expectAsync0(() {
61 var body = query('body'); 62 var body = query('body');
62 63
63 var label = findWithText(body, 'four (checked)'); 64 var label = findWithText(body, 'four (checked)');
64 expect(label is LabelElement, isTrue, reason: 'text is in a label: $label'); 65 expect(label is LabelElement, isTrue, reason: 'text is in a label: $label' );
Siggi Cherem (dart-lang) 2013/10/21 21:07:42 80
Jennifer Messerly 2013/10/21 21:42:56 Done.
65 66
66 var host = findShadowHost(body, label.parentNode); 67 var host = findShadowHost(body, label.parentNode);
67 var node = host.parent.query('input'); 68 var node = host.parent.query('input');
68 expect(node is InputElement, isTrue, reason: 'node is a checkbox'); 69 expect(node is InputElement, isTrue, reason: 'node is a checkbox');
69 expect(node.type, 'checkbox', reason: 'node type is checkbox'); 70 expect(node.type, 'checkbox', reason: 'node type is checkbox');
70 expect(node.checked, isFalse, reason: 'element is unchecked'); 71 expect(node.checked, isFalse, reason: 'element is unchecked');
71 72
72 node.dispatchEvent(new MouseEvent('click', detail: 1)); 73 node.dispatchEvent(new MouseEvent('click', detail: 1));
73 expect(node.checked, isTrue, reason: 'element is checked'); 74 expect(node.checked, isTrue, reason: 'element is checked');
75 }));
74 }); 76 });
75 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698