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

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

Issue 79353003: [polymer.dart] fix *Changed observers inheriting (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
« no previous file with comments | « pkg/polymer/test/events_test.html ('k') | pkg/polymer/test/property_change_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/property_change_test.dart
diff --git a/pkg/polymer/test/property_change_test.dart b/pkg/polymer/test/property_change_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ea41e1137732be0163b989d6475215aa17947f72
--- /dev/null
+++ b/pkg/polymer/test/property_change_test.dart
@@ -0,0 +1,58 @@
+// 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.property_change_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';
+
+// Dart note: this is a tad different from the JS code. We don't support putting
+// expandos on Dart objects and then observing them. On the other hand, we want
+// to make sure that superclass observers are correctly detected.
+
+final _zonk = new Completer();
+final _bar = new Completer();
+
+@reflectable
+class XBase extends PolymerElement {
+ @observable String zonk = '';
+
+ XBase.created() : super.created();
+
+ zonkChanged() {
+ expect(zonk, 'zonk', reason: 'change calls *Changed on superclass');
+ _zonk.complete();
+ }
+}
+
+@CustomTag('x-test')
+class XTest extends XBase {
+ @observable String bar = '';
+
+ XTest.created() : super.created();
+
+ ready() {
+ bar = 'bar';
+ new Future(() { zonk = 'zonk'; });
+ }
+
+ barChanged() {
+ expect(bar, 'bar', reason: 'change in ready calls *Changed');
+ _bar.complete();
+ }
+}
+
+main() {
+ initPolymer();
+ useHtmlConfiguration();
+
+ setUp(() => Polymer.onReady);
+
+ test('bar change detected', () => _bar.future);
+ test('zonk change detected', () => _zonk.future);
+}
« no previous file with comments | « pkg/polymer/test/events_test.html ('k') | pkg/polymer/test/property_change_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698