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

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

Issue 66253002: Version 0.8.10.9 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: 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
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: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';
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 = querySelector('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 Observable.dirtyCheck(); 35 Observable.dirtyCheck();
36 return window.animationFrame.then((_) { 36 return window.animationFrame.then((_) {
37 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 37 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 3);
38 38
39 // TODO(jmesserly): HTML Imports breaks relative hash links when the 39 // TODO(jmesserly): HTML Imports breaks relative hash links when the
40 // 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
41 // fix it programmatically. 41 // fix it programmatically.
42 for (var a in root.queryAll('#filters > li > a')) { 42 for (var a in root.querySelectorAll('#filters > li > a')) {
43 a.href = '#${Uri.parse(a.href).fragment}'; 43 a.href = '#${Uri.parse(a.href).fragment}';
44 } 44 }
45 }); 45 });
46 }); 46 });
47 47
48 test('navigate to #/active', () { 48 test('navigate to #/active', () {
49 windowLocation.hash = '#/active'; 49 windowLocation.hash = '#/active';
50 return window.animationFrame.then((_) { 50 return window.animationFrame.then((_) {
51 expect(root.queryAll('#todo-list li[is=todo-row]').length, 2); 51 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 2);
52 }); 52 });
53 }); 53 });
54 54
55 test('navigate to #/completed', () { 55 test('navigate to #/completed', () {
56 windowLocation.hash = '#/completed'; 56 windowLocation.hash = '#/completed';
57 return window.animationFrame.then((_) { 57 return window.animationFrame.then((_) {
58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); 58 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 1);
59 }); 59 });
60 }); 60 });
61 61
62 test('navigate back to #/', () { 62 test('navigate back to #/', () {
63 windowLocation.hash = '#/'; 63 windowLocation.hash = '#/';
64 return window.animationFrame.then((_) { 64 return window.animationFrame.then((_) {
65 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 65 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 3);
66 }); 66 });
67 }); 67 });
68 } 68 }
OLDNEW
« no previous file with comments | « dart/samples/third_party/todomvc/.buildlog ('k') | dart/samples/third_party/todomvc/test/mainpage_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698