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

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

Issue 469823002: Roll polymer to 0.3.5 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: style nit Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 27 matching lines...) Expand all
38 class DartTwoWay extends PolymerElement { 38 class DartTwoWay extends PolymerElement {
39 @observable var twoWay = 40; 39 @observable var twoWay = 40;
40 DartTwoWay.created() : super.created(); 40 DartTwoWay.created() : super.created();
41 } 41 }
42 42
43 main() => initPolymer().run(() { 43 main() => initPolymer().run(() {
44 useHtmlConfiguration(); 44 useHtmlConfiguration();
45 45
46 setUp(() => Polymer.onReady); 46 setUp(() => Polymer.onReady);
47 47
48 test('elements can be passed through Node.bind to JS', () {
49 var text = querySelector('dart-element2')
50 .shadowRoot.querySelector('js-element2')
51 .shadowRoot.text;
52 expect(text, 'QUX:123');
53 });
54
48 test('dart-element upgraded', () { 55 test('dart-element upgraded', () {
49 expect(querySelector('dart-element') is DartElement, true, 56 expect(querySelector('dart-element') is DartElement, true,
50 reason: 'dart-element upgraded'); 57 reason: 'dart-element upgraded');
51 }); 58 });
52 59
53 test('js-element in body', () => testInterop( 60 test('js-element in body', () => testInterop(
54 querySelector('js-element'))); 61 querySelector('js-element')));
55 62
56 test('js-element in dart-element', () => testInterop( 63 test('js-element in dart-element', () => testInterop(
57 querySelector('dart-element').shadowRoot.querySelector('js-element'))); 64 querySelector('dart-element').shadowRoot.querySelector('js-element')));
58 65
59 test('elements can be passed through Node.bind to JS', () {
60 var text = querySelector('dart-element2')
61 .shadowRoot.querySelector('js-element2')
62 .shadowRoot.text;
63 expect(text, 'QUX:123');
64 });
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');
73 }); 73 });
74 }); 74 });
75 75
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/event_binding_release_handler_test.html ('k') | pkg/polymer/test/prop_attr_reflection_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698