OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |