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

Side by Side Diff: tests/html/js_test.dart

Issue 26270003: Cleanup JS() expressions. New Constructor for JsObject that preserves the correct prototype. Type c… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add expect() to constructor test Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 jsTest; 5 library jsTest;
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 10
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 final bufView = new JsObject(context['Uint8Array'], [buf]); 321 final bufView = new JsObject(context['Uint8Array'], [buf]);
322 for (var i = 0; i < codeUnits.length; i++) { 322 for (var i = 0; i < codeUnits.length; i++) {
323 bufView[i] = codeUnits[i]; 323 bufView[i] = codeUnits[i];
324 } 324 }
325 } 325 }
326 }); 326 });
327 327
328 test('js instantiation : >10 parameters', () { 328 test('js instantiation : >10 parameters', () {
329 final o = new JsObject(context['Baz'], [1,2,3,4,5,6,7,8,9,10,11]); 329 final o = new JsObject(context['Baz'], [1,2,3,4,5,6,7,8,9,10,11]);
330 for (var i = 1; i <= 11; i++) { 330 for (var i = 1; i <= 11; i++) {
331 o["f$i"] = i; 331 expect(o["f$i"], i);
332 } 332 }
333 expect(o['constructor'], same(context['Baz']));
333 }); 334 });
334 335
335 test('write global field', () { 336 test('write global field', () {
336 context['y'] = 42; 337 context['y'] = 42;
337 expect(context['y'], equals(42)); 338 expect(context['y'], equals(42));
338 }); 339 });
339 340
340 test('get JS JsFunction', () { 341 test('get JS JsFunction', () {
341 var razzle = context['razzle']; 342 var razzle = context['razzle'];
342 expect(razzle.apply(context), equals(42)); 343 expect(razzle.apply(context), equals(42));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 expect(context.callMethod('Bar'), "ret_value"); 505 expect(context.callMethod('Bar'), "ret_value");
505 expect(context['Bar']['foo'], "property_value"); 506 expect(context['Bar']['foo'], "property_value");
506 }); 507 });
507 508
508 test('usage of Serializable', () { 509 test('usage of Serializable', () {
509 final red = Color.RED; 510 final red = Color.RED;
510 context['color'] = red; 511 context['color'] = red;
511 expect(context['color'], equals(red._value)); 512 expect(context['color'], equals(red._value));
512 }); 513 });
513 } 514 }
OLDNEW
« sdk/lib/js/dart2js/js_dart2js.dart ('K') | « sdk/lib/js/dart2js/js_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698