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

Unified Diff: samples/third_party/todomvc/test/mainpage_test.dart

Issue 77373002: "Reverting 30388" (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 side-by-side diff with in-line comments
Download patch
Index: samples/third_party/todomvc/test/mainpage_test.dart
diff --git a/samples/third_party/todomvc/test/mainpage_test.dart b/samples/third_party/todomvc/test/mainpage_test.dart
index 7b6d8f3b44d1e7c041ef974d01a4eee1d4f2528f..b919607e111010b4a18e7e66fdd613b68b9d1e90 100644
--- a/samples/third_party/todomvc/test/mainpage_test.dart
+++ b/samples/third_party/todomvc/test/mainpage_test.dart
@@ -4,17 +4,19 @@
library todomvc.test.mainpage_test;
+import 'dart:async';
import 'dart:html';
+import 'dart:js' as js;
import 'package:polymer/polymer.dart';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';
-import '../web/app.dart';
-import '../web/model.dart';
+import '../web/elements/td_model.dart';
+import '../web/elements/td_todos.dart';
+import 'utils.dart';
/**
* This test runs the TodoMVC app and checks the state of the initial page.
*/
-// TODO(jmesserly): verify some styles (colors, fonts, relative size) as well.
main() {
initPolymer();
useHtmlConfiguration();
@@ -22,21 +24,35 @@ main() {
setUp(() => Polymer.onReady);
test('initial state', () {
- final todoApp = querySelector('todo-app');
- expect(appModel.todos.length, 0);
- expect(todoApp.xtag is TodoApp, true, reason: 'TodoApp should be created');
+ final model = querySelector('td-model');
+ expect(model is TodoModel, true, reason: 'TodoModel should be created');
- final root = todoApp.shadowRoot;
+ final app = querySelector('td-todos');
+ expect(app is TodoList, true, reason: 'TodoList should be created');
+
+ final root = app.shadowRoot;
final newTodo = root.querySelector('#new-todo');
expect(newTodo.placeholder, "What needs to be done?");
- // TODO(jmesserly): re-enable this. It fails on Firefox with ShadowDOM.
- // The issue appears to be that
- // Wait for setTimeout 0 for focus to activate.
- /*Timer.run(expectAsync0(() {
- expect(document.activeElement, todoApp, reason: 'app should have focus');
- expect(root.activeElement, newTodo, reason: 'New todo should have focus');
- expect(root.querySelectorAll('[is=todo-row]').length, 0, reason: 'no items yet');
- }));*/
+ expect(app.modelId, 'model', reason: 'modelId is set via attribute');
+
+ // Validate the stylesheet was loaded
+ if (js.context.hasProperty('ShadowDOMPolyfill')) {
+ final style = document.head.querySelector('style[ShadowCSSShim]');
+ expect(style.text, contains('\ntd-todos #todoapp {'));
+ } else {
+ final style = root.querySelector('style');
+ expect(style, isNotNull, reason: '<link> was replaced with <style>');
+ expect(style.text, contains('\n#todoapp {'));
+ }
+
+ // Validate a style got applied
+ var color = root.querySelector('#footer').getComputedStyle().color;
+ expect(color, 'rgb(119, 119, 119)');
+
+ return onPropertyInit(model, 'items').then((_) {
+ expect(model.items, [], reason: 'no items yet');
+ expect(app.model, model, reason: 'model should be data-bound');
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698