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

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

Issue 27307004: Converting Polymer's WebComponentsLoaded to an onReady future (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.listorder_test; 5 library todomvc.test.listorder_test;
6 6
7 import 'dart:async';
8 import 'dart:html'; 7 import 'dart:html';
9 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
10 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
11 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
12 import '../web/model.dart'; 11 import '../web/model.dart';
13 12
14 /** 13 /**
15 * This test runs the TodoMVC app, adds a few elements, marks some as done, and 14 * 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 15 * switches from back and forth between "Active" and "All". This will make some
17 * nodes to be hidden and readded to the page. 16 * nodes to be hidden and readded to the page.
18 */ 17 */
19 main() { 18 main() {
20 useHtmlConfiguration(); 19 useHtmlConfiguration();
21 20
22 final root = query('todo-app').shadowRoot; 21 final root = query('todo-app').shadowRoot;
23 22
24 setUp(() => new Future.delayed(Duration.ZERO)); 23 setUp(() => Polymer.onReady);
25 24
26 test('programmatically add items to model', () { 25 test('programmatically add items to model', () {
27 appModel.todos.addAll([ 26 appModel.todos.addAll([
28 new Todo('one (unchecked)'), 27 new Todo('one (unchecked)'),
29 new Todo('two (checked)')..done = true, 28 new Todo('two (checked)')..done = true,
30 new Todo('three (unchecked)') 29 new Todo('three (unchecked)')
31 ]); 30 ]);
32 performMicrotaskCheckpoint(); 31 performMicrotaskCheckpoint();
33 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 32 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
34 33
(...skipping 16 matching lines...) Expand all
51 performMicrotaskCheckpoint(); 50 performMicrotaskCheckpoint();
52 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); 51 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1);
53 }); 52 });
54 53
55 test('navigate back to #/', () { 54 test('navigate back to #/', () {
56 windowLocation.hash = '#/'; 55 windowLocation.hash = '#/';
57 performMicrotaskCheckpoint(); 56 performMicrotaskCheckpoint();
58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 57 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
59 }); 58 });
60 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698