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

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

Issue 41293002: Fixes from polymer.dart API review (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made Job a part of polymer Created 7 years, 1 month 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
« no previous file with comments | « pkg/polymer/test/unbind_test.dart ('k') | samples/third_party/todomvc/test/markdone_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.listorder_test; 5 library todomvc.test.listorder_test;
6 6
7 import 'dart:async';
7 import 'dart:html'; 8 import 'dart:html';
8 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
9 import 'package:polymer/platform.dart' show endOfMicrotask;
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import 'package:unittest/html_config.dart'; 11 import 'package:unittest/html_config.dart';
12 import '../web/model.dart'; 12 import '../web/model.dart';
13 13
14 /** 14 /**
15 * This test runs the TodoMVC app, adds a few elements, marks some as done, and 15 * This test runs the TodoMVC app, adds a few elements, marks some as done, and
16 * switches from back and forth between "Active" and "All". This will make some 16 * switches from back and forth between "Active" and "All". This will make some
17 * nodes to be hidden and readded to the page. 17 * nodes to be hidden and readded to the page.
18 */ 18 */
19 main() { 19 main() {
20 initPolymer(); 20 initPolymer();
21 useHtmlConfiguration(); 21 useHtmlConfiguration();
22 22
23 ShadowRoot root; 23 ShadowRoot root;
24 24
25 setUp(() => Polymer.onReady.then((_) { 25 setUp(() => Polymer.onReady.then((_) {
26 root = query('todo-app').shadowRoot; 26 root = query('todo-app').shadowRoot;
27 })); 27 }));
28 28
29 test('programmatically add items to model', () { 29 test('programmatically add items to model', () {
30 appModel.todos.addAll([ 30 appModel.todos.addAll([
31 new Todo('one (unchecked)'), 31 new Todo('one (unchecked)'),
32 new Todo('two (checked)')..done = true, 32 new Todo('two (checked)')..done = true,
33 new Todo('three (unchecked)') 33 new Todo('three (unchecked)')
34 ]); 34 ]);
35 endOfMicrotask(expectAsync0(() { 35 Observable.dirtyCheck();
36 return window.animationFrame.then((_) {
Jennifer Messerly 2013/10/25 21:02:21 one idea here is to use mutation observers to watc
36 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 37 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
37 38
38 // TODO(jmesserly): HTML Imports breaks relative hash links when the 39 // TODO(jmesserly): HTML Imports breaks relative hash links when the
39 // component is at a different path from the main HTML document. For now 40 // component is at a different path from the main HTML document. For now
40 // fix it programmatically. 41 // fix it programmatically.
41 for (var a in root.queryAll('#filters > li > a')) { 42 for (var a in root.queryAll('#filters > li > a')) {
42 a.href = '#${Uri.parse(a.href).fragment}'; 43 a.href = '#${Uri.parse(a.href).fragment}';
43 } 44 }
44 })); 45 });
45 }); 46 });
46 47
47 test('navigate to #/active', () { 48 test('navigate to #/active', () {
48 windowLocation.hash = '#/active'; 49 windowLocation.hash = '#/active';
49 endOfMicrotask(expectAsync0(() { 50 return window.animationFrame.then((_) {
50 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); 51 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2);
51 })); 52 });
52 }); 53 });
53 54
54 test('navigate to #/completed', () { 55 test('navigate to #/completed', () {
55 windowLocation.hash = '#/completed'; 56 windowLocation.hash = '#/completed';
56 endOfMicrotask(expectAsync0(() { 57 return window.animationFrame.then((_) {
57 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); 58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1);
58 })); 59 });
59 }); 60 });
60 61
61 test('navigate back to #/', () { 62 test('navigate back to #/', () {
62 windowLocation.hash = '#/'; 63 windowLocation.hash = '#/';
63 endOfMicrotask(expectAsync0(() { 64 return window.animationFrame.then((_) {
64 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 65 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
65 })); 66 });
66 }); 67 });
67 } 68 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/unbind_test.dart ('k') | samples/third_party/todomvc/test/markdone_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698