Chromium Code Reviews| Index: pkg/polymer/test/js_interop_test.dart |
| diff --git a/pkg/polymer/test/js_interop_test.dart b/pkg/polymer/test/js_interop_test.dart |
| index 3704ccb93addc5a6d30b535d2459d6cb484bd6bf..77c8d59cba9e47e0214a3c591a80e880595cbba0 100644 |
| --- a/pkg/polymer/test/js_interop_test.dart |
| +++ b/pkg/polymer/test/js_interop_test.dart |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2014, 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. |
| @@ -16,6 +16,24 @@ class DartElement extends PolymerElement { |
| DartElement.created() : super.created(); |
| } |
| +@CustomTag("dart-element2") |
| +class DartElement2 extends PolymerElement { |
| + Element get quux => this.querySelector('.quux'); |
| + DartElement2.created() : super.created(); |
| +} |
| + |
| +@CustomTag("dart-element3") |
| +class DartElement3 extends PolymerElement { |
| + @observable var quux; |
| + DartElement3.created() : super.created(); |
| + |
| + domReady() { |
| + quux = new JsObject.jsify({ |
| + 'aDartMethod': (x) => 444 + x |
| + }); |
| + } |
| +} |
| + |
| main() => initPolymer().run(() { |
| useHtmlConfiguration(); |
| @@ -31,6 +49,23 @@ main() => initPolymer().run(() { |
| test('js-element in dart-element', () => testInterop( |
| querySelector('dart-element').shadowRoot.querySelector('js-element'))); |
| + |
| + test('elements can be passed through Node.bind to JS', () { |
| + var text = querySelector('dart-element2') |
| + .shadowRoot.querySelector('js-element2') |
| + .shadowRoot.text; |
| + expect(text, 'QUX:123'); |
| + }); |
| + |
| + test('objects with funcdtions can be passed through Node.bind to JS', () { |
|
Siggi Cherem (dart-lang)
2014/06/27 18:40:52
funcdtions => functions
Jennifer Messerly
2014/06/27 19:10:03
eek good catch!
|
| + var sr = querySelector('dart-element3') |
| + .shadowRoot.querySelector('js-element3') |
| + .shadowRoot; |
| + |
| + return new Future(() { |
| + expect(sr.text, 'js-element3[qux]:765'); |
| + }); |
| + }); |
| }); |
| testInterop(jsElem) { |