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

Unified Diff: pkg/polymer/test/entered_view_test.dart

Issue 112433002: update our CustomElement+Shadow DOM patch (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | pkg/polymer/test/entered_view_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/entered_view_test.dart
diff --git a/pkg/polymer/test/entered_view_test.dart b/pkg/polymer/test/entered_view_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c9f7b34341080f5d4290e10df19c4071d3c6ab86
--- /dev/null
+++ b/pkg/polymer/test/entered_view_test.dart
@@ -0,0 +1,54 @@
+// 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 polymer.test.entered_view_test;
+
+import 'dart:async';
+import 'dart:html';
+import 'package:polymer/polymer.dart';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:unittest/matcher.dart';
+
+@reflectable
+class XOuter extends PolymerElement {
+ @observable bool expand = false;
+
+ XOuter.created() : super.created();
+}
+
+@reflectable
+class XInner extends PolymerElement {
+ int enteredCount = 0;
+
+ XInner.created() : super.created();
+
+ enteredView() {
+ enteredCount++;
+ super.enteredView();
+ }
+}
+
+main() => initPolymer().run(_tests);
+
+_tests() {
+ useHtmlConfiguration();
+ Polymer.register('x-inner', XInner);
+ Polymer.register('x-outer', XOuter);
+
+ setUp(() => Polymer.onReady);
+
+ test('element created properly', () {
+ XOuter outer = query('x-outer');
+ outer.expand = true;
+ return outer.onMutation(outer.shadowRoot).then((_) {
+ // Element upgrade is also using mutation observers. Wait another tick so
+ // it goes before we do.
+ return new Future(() {
+ XInner inner = outer.shadowRoot.query('x-inner');
+ expect(inner.enteredCount, 1, reason: 'enteredView should be called');
+ });
+ });
+ });
+}
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | pkg/polymer/test/entered_view_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698