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

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

Issue 27903006: Improves how to initialize polymer apps and fixes polymer build and linter to (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:html'; 7 import 'dart:html';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
11 import '../web/model.dart'; 11 import '../web/model.dart';
12 12
13 /** 13 /**
14 * 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
15 * 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
16 * nodes to be hidden and readded to the page. 16 * nodes to be hidden and readded to the page.
17 */ 17 */
18 @initMethod 18 main() {
19 _main() { 19 initPolymer();
20 useHtmlConfiguration(); 20 useHtmlConfiguration();
21 21
22 final root = query('todo-app').shadowRoot; 22 final root = query('todo-app').shadowRoot;
23 23
24 wrapMicrotask((){
24 setUp(() => Polymer.onReady); 25 setUp(() => Polymer.onReady);
25 26
26 test('programmatically add items to model', () { 27 test('programmatically add items to model', () {
27 appModel.todos.addAll([ 28 appModel.todos.addAll([
28 new Todo('one (unchecked)'), 29 new Todo('one (unchecked)'),
29 new Todo('two (checked)')..done = true, 30 new Todo('two (checked)')..done = true,
30 new Todo('three (unchecked)') 31 new Todo('three (unchecked)')
31 ]); 32 ]);
32 performMicrotaskCheckpoint(); 33 performMicrotaskCheckpoint();
33 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 34 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
(...skipping 16 matching lines...) Expand all
50 windowLocation.hash = '#/completed'; 51 windowLocation.hash = '#/completed';
51 performMicrotaskCheckpoint(); 52 performMicrotaskCheckpoint();
52 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1); 53 expect(root.queryAll('#todo-list li[is=todo-row]').length, 1);
53 }); 54 });
54 55
55 test('navigate back to #/', () { 56 test('navigate back to #/', () {
56 windowLocation.hash = '#/'; 57 windowLocation.hash = '#/';
57 performMicrotaskCheckpoint(); 58 performMicrotaskCheckpoint();
58 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3); 59 expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
59 }); 60 });
61 })();
60 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698