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

Unified Diff: samples/tests/samples/todomvc/listorder_test.dart

Issue 23539003: Turn on Polymer TodoMVC tests on Dart buildbots (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use unittest test_controller.js Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: samples/tests/samples/todomvc/listorder_test.dart
diff --git a/samples/tests/samples/todomvc/listorder_test.dart b/samples/tests/samples/todomvc/listorder_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..aff00e3b1c8611cf1300ede6c3287ebd25b716c4
--- /dev/null
+++ b/samples/tests/samples/todomvc/listorder_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library todomvc.test.listorder_test;
+
+import 'dart:html';
+import 'package:polymer/polymer.dart';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import '../../../third_party/todomvc/web/model.dart';
+
+/**
+ * This test runs the TodoMVC app, adds a few elements, marks some as done, and
+ * switches from back and forth between "Active" and "All". This will make some
+ * nodes to be hidden and readded to the page.
+ */
+main() {
+ useHtmlConfiguration();
+
+ final root = query('todo-app').shadowRoot;
+
+ test('programmatically add items to model', () {
+ appModel.todos.addAll([
+ new Todo('one (unchecked)'),
+ new Todo('two (checked)')..done = true,
+ new Todo('three (unchecked)')
+ ]);
+ performMicrotaskCheckpoint();
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
+
+ // TODO(jmesserly): HTML Imports breaks relative hash links when the
+ // component is at a different path from the main HTML document. For now we
+ // fix it programmatically.
+ for (var a in root.queryAll('#filters > li > a')) {
+ a.href = '#${Uri.parse(a.href).fragment}';
+ }
+ });
+
+ test('navigate to #/active', () {
+ windowLocation.hash = '#/active';
+ performMicrotaskCheckpoint();
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 2);
+ });
+
+ test('navigate to #/completed', () {
+ windowLocation.hash = '#/completed';
+ performMicrotaskCheckpoint();
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 1);
+ });
+
+ test('navigate back to #/', () {
+ windowLocation.hash = '#/';
+ performMicrotaskCheckpoint();
+ expect(root.queryAll('#todo-list li[is=todo-row]').length, 3);
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698