| 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);
|
| - }
|
| -}
|
|
|