| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.web.js_interop_test; | 5 library polymer.test.web.js_interop_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:js'; | 9 import 'dart:js'; |
| 10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 test('js-element in body', () => testInterop( | 53 test('js-element in body', () => testInterop( |
| 54 querySelector('js-element'))); | 54 querySelector('js-element'))); |
| 55 | 55 |
| 56 test('js-element in dart-element', () => testInterop( | 56 test('js-element in dart-element', () => testInterop( |
| 57 querySelector('dart-element').shadowRoot.querySelector('js-element'))); | 57 querySelector('dart-element').shadowRoot.querySelector('js-element'))); |
| 58 | 58 |
| 59 test('elements can be passed through Node.bind to JS', () { | 59 test('elements can be passed through Node.bind to JS', () { |
| 60 var text = querySelector('dart-element2') | 60 var text = querySelector('dart-element2') |
| 61 .shadowRoot.querySelector('js-element2') | 61 .shadowRoot.querySelector('js-element2') |
| 62 .shadowRoot.text; | 62 .shadowRoot.text; |
| 63 expect(text, 'QUX:123'); | 63 expect(text, 'QUX:123'); |
| 64 }); | 64 }); |
| 65 | 65 |
| 66 test('objects with functions can be passed through Node.bind to JS', () { | 66 test('objects with functions can be passed through Node.bind to JS', () { |
| 67 var sr = querySelector('dart-element3') | 67 var sr = querySelector('dart-element3') |
| 68 .shadowRoot.querySelector('js-element3') | 68 .shadowRoot.querySelector('js-element3') |
| 69 .shadowRoot; | 69 .shadowRoot; |
| 70 | 70 |
| 71 return new Future(() { | 71 return new Future(() { |
| 72 expect(sr.text, 'js-element3[qux]:765'); | 72 expect(sr.text, 'js-element3[qux]:765'); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 /// Calls Platform.flush() to flush Polymer.js pending operations, e.g. | 140 /// Calls Platform.flush() to flush Polymer.js pending operations, e.g. |
| 141 /// dirty checking for data-bindings. | 141 /// dirty checking for data-bindings. |
| 142 Future flush() { | 142 Future flush() { |
| 143 var Platform = context['Platform']; | 143 var Platform = context['Platform']; |
| 144 Platform.callMethod('flush'); | 144 Platform.callMethod('flush'); |
| 145 | 145 |
| 146 var completer = new Completer(); | 146 var completer = new Completer(); |
| 147 Platform.callMethod('endOfMicrotask', [() => completer.complete()]); | 147 Platform.callMethod('endOfMicrotask', [() => completer.complete()]); |
| 148 return completer.future; | 148 return completer.future; |
| 149 } | 149 } |
| OLD | NEW |