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

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

Issue 76013002: "Reverting 30387" -- failures on IE (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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/elements/td_model.dart'; 12 import '../web/model.dart';
13 import '../web/elements/td_todos.dart';
14 import 'utils.dart';
15 13
16 /** 14 /**
17 * 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
18 * 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
19 * nodes to be hidden and readded to the page. 17 * nodes to be hidden and readded to the page.
20 */ 18 */
21 main() { 19 main() {
22 initPolymer(); 20 initPolymer();
23 useHtmlConfiguration(); 21 useHtmlConfiguration();
24 22
25 ShadowRoot root; 23 ShadowRoot root;
26 TodoModel model;
27 24
28 setUp(() => Polymer.onReady.then((_) { 25 setUp(() => Polymer.onReady.then((_) {
29 root = querySelector('td-todos').shadowRoot; 26 root = querySelector('todo-app').shadowRoot;
30 model = querySelector('td-model');
31 return onPropertyInit(model, 'items');
32 })); 27 }));
33 28
34 test('programmatically add items to model', () { 29 test('programmatically add items to model', () {
35 model.items.addAll([ 30 appModel.todos.addAll([
36 new Todo('one (unchecked)'), 31 new Todo('one (unchecked)'),
37 new Todo('two (checked)')..completed = true, 32 new Todo('two (checked)')..done = true,
38 new Todo('three (unchecked)') 33 new Todo('three (unchecked)')
39 ]); 34 ]);
40 Observable.dirtyCheck(); 35 Observable.dirtyCheck();
41 return window.animationFrame.then((_) { 36 return window.animationFrame.then((_) {
42 expect(root.querySelectorAll('#todo-list li[is=td-item]').length, 3); 37 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 3);
43 38
44 // TODO(jmesserly): HTML Imports breaks relative hash links when the 39 // TODO(jmesserly): HTML Imports breaks relative hash links when the
45 // 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
46 // fix it programmatically. 41 // fix it programmatically.
47 for (var a in root.querySelectorAll('#filters > li > a')) { 42 for (var a in root.querySelectorAll('#filters > li > a')) {
48 a.href = '#${Uri.parse(a.href).fragment}'; 43 a.href = '#${Uri.parse(a.href).fragment}';
49 } 44 }
50 }); 45 });
51 }); 46 });
52 47
53 test('navigate to #/active', () { 48 test('navigate to #/active', () {
54 windowLocation.hash = '#/active'; 49 windowLocation.hash = '#/active';
55 return window.animationFrame.then((_) { 50 return window.animationFrame.then((_) {
56 expect(root.querySelectorAll('#todo-list li[is=td-item]').length, 2); 51 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 2);
57 }); 52 });
58 }); 53 });
59 54
60 test('navigate to #/completed', () { 55 test('navigate to #/completed', () {
61 windowLocation.hash = '#/completed'; 56 windowLocation.hash = '#/completed';
62 return window.animationFrame.then((_) { 57 return window.animationFrame.then((_) {
63 expect(root.querySelectorAll('#todo-list li[is=td-item]').length, 1); 58 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 1);
64 }); 59 });
65 }); 60 });
66 61
67 test('navigate back to #/', () { 62 test('navigate back to #/', () {
68 windowLocation.hash = '#/'; 63 windowLocation.hash = '#/';
69 return window.animationFrame.then((_) { 64 return window.animationFrame.then((_) {
70 expect(root.querySelectorAll('#todo-list li[is=td-item]').length, 3); 65 expect(root.querySelectorAll('#todo-list li[is=todo-row]').length, 3);
71 }); 66 });
72 }); 67 });
73 } 68 }
OLDNEW
« no previous file with comments | « samples/third_party/todomvc/pubspec.yaml ('k') | samples/third_party/todomvc/test/listorder_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698