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

Unified Diff: pkg/template_binding/test/custom_element_bindings_test.dart

Issue 355133002: switch Node.bind to interop (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
« no previous file with comments | « pkg/template_binding/pubspec.yaml ('k') | pkg/template_binding/test/node_bind_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/test/custom_element_bindings_test.dart
diff --git a/pkg/template_binding/test/custom_element_bindings_test.dart b/pkg/template_binding/test/custom_element_bindings_test.dart
index 17068a4c2f1961f654f73cee6a7942f288b151a4..0b53033bb5c5b4e43978559a0071c1d6e50ccaf3 100644
--- a/pkg/template_binding/test/custom_element_bindings_test.dart
+++ b/pkg/template_binding/test/custom_element_bindings_test.dart
@@ -21,8 +21,6 @@ main() => dirtyCheckZone().run(() {
_registered = customElementsReady.then((_) {
document.registerElement('my-custom-element', MyCustomElement);
- document.registerElement('with-attrs-custom-element',
- WithAttrsCustomElement);
});
group('Custom Element Bindings', customElementBindingsTest);
@@ -75,49 +73,6 @@ customElementBindingsTest() {
});
});
- test('override attribute setter', () {
- var element = new WithAttrsCustomElement();
- var model = toObservable({'a': 1, 'b': 2});
- nodeBind(element).bind('hidden?', new PathObserver(model, 'a'));
- nodeBind(element).bind('id', new PathObserver(model, 'b'));
-
- expect(element.attributes, contains('hidden'));
- expect(element.attributes['hidden'], '');
- expect(element.id, '2');
-
- model['a'] = null;
- return new Future(() {
- expect(element.attributes, isNot(contains('hidden')),
- reason: 'null is false-y');
-
- model['a'] = false;
- }).then(endOfMicrotask).then((_) {
- expect(element.attributes, isNot(contains('hidden')));
-
- model['a'] = 'foo';
- // TODO(jmesserly): this is here to force an ordering between the two
- // changes. Otherwise the order depends on what order StreamController
- // chooses to fire the two listeners in.
- }).then(endOfMicrotask).then((_) {
-
- model['b'] = 'x';
- }).then(endOfMicrotask).then((_) {
- expect(element.attributes, contains('hidden'));
- expect(element.attributes['hidden'], '');
- expect(element.id, 'x');
-
- expect(element.attributes.log, [
- ['remove', 'hidden?'],
- ['[]=', 'hidden', ''],
- ['[]=', 'id', '2'],
- ['remove', 'hidden'],
- ['remove', 'hidden'],
- ['[]=', 'hidden', ''],
- ['[]=', 'id', 'x'],
- ]);
- });
- });
-
test('template bind uses overridden custom element bind', () {
var model = toObservable({'a': new Point(123, 444), 'b': new Monster(100)});
@@ -217,37 +172,3 @@ class MyCustomElement extends HtmlElement implements NodeBindExtension {
}
}
-
-/**
- * Demonstrates a custom element can override attributes []= and remove.
- * and see changes that the data binding system is making to the attributes.
- */
-class WithAttrsCustomElement extends HtmlElement {
- AttributeMapWrapper _attributes;
-
- factory WithAttrsCustomElement() =>
- new Element.tag('with-attrs-custom-element');
-
- WithAttrsCustomElement.created() : super.created() {
- _attributes = new AttributeMapWrapper(super.attributes);
- }
-
- get attributes => _attributes;
-}
-
-// TODO(jmesserly): would be nice to use mocks when mirrors work on dart2js.
-class AttributeMapWrapper<K, V> extends MapView<K, V> {
- final List log = [];
-
- AttributeMapWrapper(Map map) : super(map);
-
- void operator []=(K key, V value) {
- log.add(['[]=', key, value]);
- super[key] = value;
- }
-
- V remove(Object key) {
- log.add(['remove', key]);
- return super.remove(key);
- }
-}
« no previous file with comments | « pkg/template_binding/pubspec.yaml ('k') | pkg/template_binding/test/node_bind_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698