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

Side by Side Diff: test_sources/non_transformed/web/generated_code_test.dart

Issue 615913004: Add @jsify annotation. Support automatically proxying Lists and Maps to Dart in Proxies. Support co… (Closed) Base URL: https://github.com/dart-lang/js-interop.git@master
Patch Set: Created 6 years, 2 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
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 js.test.transformer.generated_code_test; 5 library js.test.transformer.generated_code_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:js' as js; 8 import 'dart:js' as js;
9 9
10 import 'package:js/js.dart'; 10 import 'package:js/js.dart';
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 expect(name, 'blue'); 109 expect(name, 'blue');
110 }); 110 });
111 111
112 test('should return proxy values', () { 112 test('should return proxy values', () {
113 var foo = new t.JsFoo('red'); 113 var foo = new t.JsFoo('red');
114 var bar = new t.JsBar('blue'); 114 var bar = new t.JsBar('blue');
115 foo.setBar(bar); 115 foo.setBar(bar);
116 expect(foo.bar, bar); 116 expect(foo.bar, bar);
117 }); 117 });
118 118
119 test('should return Lists', () {
120 var library2 = new l2.Library2();
121 var l = library2.createList('1', 'b', 'z');
122 expect(l, ['1', 'b', 'z']);
123 });
124
125 test('should accept Lists', () {
126 var library2 = new l2.Library2();
127 var s = library2.joinList(['1', 'b', 'z']);
128 expect(s, '1, b, z');
129 });
130
131 test('should return Lists of proxies', () {
132 var library2 = new l2.Library2();
133 var a = new t.JsFoo('a');
134 var b = new t.JsFoo('b');
135 var c = new t.JsFoo('c');
136
137 var l = library2.createList(a, b, c);
138 expect(l[0], same(a));
139 expect(l[1], same(b));
140 expect(l[2], same(c));
141 });
142
143 test('should accept Lists of Proxies', () {
144 var library2 = new l2.Library2();
145 var a = new t.JsFoo('a');
146 var b = new t.JsFoo('b');
147 var c = new t.JsFoo('c');
148
149 var s = library2.joinList([a, b, c]);
150 expect(s, 'a, b, c');
151 });
152
153 test('should return Maps', () {
154 var library2 = new l2.Library2();
155 var m = library2.createMap('a', 1, 'z', 26);
156 expect(m, {'a': 1, 'z': 26});
157 });
158
159 test('should accept Maps', () {
160 var library2 = new l2.Library2();
161 var s = library2.joinMap({'a': 1, 'z': 26});
162 expect(s, 'a: 1, z: 26');
163 });
164
165 test('should return Maps of proxies', () {
166 var library2 = new l2.Library2();
167 var a = new t.JsFoo('a');
168 var b = new t.JsFoo('b');
169 var m = library2.createMap('a', a, 'b', b);
170 expect(m['a'], same(a));
171 expect(m['b'], same(b));
172 });
173
119 test('should accept exported object as arguments', () { 174 test('should accept exported object as arguments', () {
120 var foo = new t.JsFoo('red'); 175 var foo = new t.JsFoo('red');
121 var bar = new t.ExportMe.named('blue'); 176 var bar = new t.ExportMe.named('blue');
122 var name = foo.getName(bar); 177 var name = foo.getName(bar);
123 expect(name, 'blue'); 178 expect(name, 'blue');
124 }); 179 });
125 180
126 test('should create objects with constructor paths', () { 181 test('should create objects with constructor paths', () {
127 var gizmo = new l2.Gizmo('green'); 182 var gizmo = new l2.Gizmo('green');
128 expect(gizmo.x, 'green'); 183 expect(gizmo.x, 'green');
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 test('should not export non-exported classes', () { 307 test('should not export non-exported classes', () {
253 expect(js.context['dart']['test']['library2'], isNotNull); 308 expect(js.context['dart']['test']['library2'], isNotNull);
254 expect(js.context['dart']['test']['library2']['DartOnly'], isNull); 309 expect(js.context['dart']['test']['library2']['DartOnly'], isNull);
255 expect(js.context['dart']['test']['library2']['Library2'], isNull); 310 expect(js.context['dart']['test']['library2']['Library2'], isNull);
256 expect(js.context['dart']['test']['library2']['Library2Impl'], isNull); 311 expect(js.context['dart']['test']['library2']['Library2Impl'], isNull);
257 }); 312 });
258 313
259 }); 314 });
260 315
261 } 316 }
OLDNEW
« lib/src/mirrors.dart ('K') | « test_sources/non_transformed/lib/library2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698