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

Side by Side Diff: dart/pkg/polymer/test/unbind_test.dart

Issue 23455028: Mirrors overhaul. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r29550. 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 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 polymer.test.unbind_test; 5 library polymer.test.unbind_test;
6 6
7 import 'dart:async' show Future, scheduleMicrotask; 7 import 'dart:async' show Future, scheduleMicrotask;
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 @MirrorsUsed(targets: const [Polymer], override: 'polymer.test.unbind_test') 10 @MirrorsUsed(targets: const [Polymer], override: 'polymer.test.unbind_test')
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 var lastArgs = Function.apply(tests.removeAt(0), args); 56 var lastArgs = Function.apply(tests.removeAt(0), args);
57 return testAsync(tests, delayMs, lastArgs); 57 return testAsync(tests, delayMs, lastArgs);
58 }); 58 });
59 } 59 }
60 60
61 // TODO(sorvell): In IE, the unbind time is indeterminate, so wait an 61 // TODO(sorvell): In IE, the unbind time is indeterminate, so wait an
62 // extra beat. 62 // extra beat.
63 delay(x) => new Future.delayed(new Duration(milliseconds: 50), () => x); 63 delay(x) => new Future.delayed(new Duration(milliseconds: 50), () => x);
64 64
65 // TODO(jmesserly): fix this when it's easier to get a private symbol. 65 // TODO(jmesserly): fix this when it's easier to get a private symbol.
66 final unboundSymbol = reflectClass(Polymer).variables.keys 66 final unboundSymbol = reflectClass(Polymer).declarations.keys
67 .firstWhere((s) => MirrorSystem.getName(s) == '_unbound'); 67 .firstWhere((s) => MirrorSystem.getName(s) == '_unbound');
68 68
69 _unbound(node) => reflect(node).getField(unboundSymbol).reflectee; 69 _unbound(node) => reflect(node).getField(unboundSymbol).reflectee;
70 70
71 unbindTests() { 71 unbindTests() {
72 var xTest = document.query('x-test'); 72 var xTest = document.query('x-test');
73 xTest.foo = 'bar'; 73 xTest.foo = 'bar';
74 scheduleMicrotask(Observable.dirtyCheck); 74 scheduleMicrotask(Observable.dirtyCheck);
75 75
76 return delay(null).then((_) { 76 return delay(null).then((_) {
(...skipping 29 matching lines...) Expand all
106 }).then(delay).then((node) { 106 }).then(delay).then((node) {
107 expect(_unbound(node), null, reason: 107 expect(_unbound(node), null, reason:
108 'element is bound when manually inserted'); 108 'element is bound when manually inserted');
109 node.remove(); 109 node.remove();
110 return node; 110 return node;
111 }).then(delay).then((node) { 111 }).then(delay).then((node) {
112 expect(_unbound(node), true, reason: 112 expect(_unbound(node), true, reason:
113 'element is unbound when manually removed is called'); 113 'element is unbound when manually removed is called');
114 }); 114 });
115 } 115 }
OLDNEW
« no previous file with comments | « dart/pkg/polymer/lib/src/declaration.dart ('k') | dart/pkg/polymer_expressions/lib/src/mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698