| 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 import 'dart:html'; | 5 import 'dart:html'; |
| 6 import 'dart:typed_data' show Int32List; | 6 import 'dart:typed_data' show Int32List; |
| 7 import 'dart:indexed_db' show IdbFactory, KeyRange; | 7 import 'dart:indexed_db' show IdbFactory, KeyRange; |
| 8 import 'dart:js'; | 8 import 'dart:js'; |
| 9 import 'package:js/js_util.dart' as js_util; | 9 import 'package:js/js_util.dart' as js_util; |
| 10 | 10 |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 final set = new Set.from([1, 2, 3, 4, 5, 6, 7, 8]); | 701 final set = new Set.from([1, 2, 3, 4, 5, 6, 7, 8]); |
| 702 var array = new JsObject.jsify(set); | 702 var array = new JsObject.jsify(set); |
| 703 expect(context.callMethod('isArray', [array]), isTrue); | 703 expect(context.callMethod('isArray', [array]), isTrue); |
| 704 expect(array['length'], equals(set.length)); | 704 expect(array['length'], equals(set.length)); |
| 705 for (var i = 0; i < array['length']; i++) { | 705 for (var i = 0; i < array['length']; i++) { |
| 706 expect(set.contains(array[i]), isTrue); | 706 expect(set.contains(array[i]), isTrue); |
| 707 } | 707 } |
| 708 }); | 708 }); |
| 709 | 709 |
| 710 test('convert a Map', () { | 710 test('convert a Map', () { |
| 711 var map = {'a': 1, 'b': 2, 'c': 3}; | 711 var map = { |
| 712 'a': 1, |
| 713 'b': 2, |
| 714 'c': 3, |
| 715 'd': allowInteropCaptureThis((that) => 42) |
| 716 }; |
| 712 var jsMap = new JsObject.jsify(map); | 717 var jsMap = new JsObject.jsify(map); |
| 713 expect(!context.callMethod('isArray', [jsMap]), isTrue); | 718 expect(!context.callMethod('isArray', [jsMap]), isTrue); |
| 714 for (final key in map.keys) { | 719 for (final key in map.keys) { |
| 715 expect(context.callMethod('checkMap', [jsMap, key, map[key]]), isTrue); | 720 expect(context.callMethod('checkMap', [jsMap, key, map[key]]), isTrue); |
| 716 } | 721 } |
| 717 }); | 722 }); |
| 718 | 723 |
| 719 test('deep convert a complex object', () { | 724 test('deep convert a complex object', () { |
| 720 dynamic object = { | 725 dynamic object = { |
| 721 'a': [ | 726 'a': [ |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 // TODO(jacobr): make this test pass. Currently some type information | 1020 // TODO(jacobr): make this test pass. Currently some type information |
| 1016 // is lost when typed arrays are passed between JS and Dart. | 1021 // is lost when typed arrays are passed between JS and Dart. |
| 1017 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), | 1022 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), |
| 1018 // isTrue); | 1023 // isTrue); |
| 1019 context.deleteProperty('o'); | 1024 context.deleteProperty('o'); |
| 1020 } | 1025 } |
| 1021 }); | 1026 }); |
| 1022 }); | 1027 }); |
| 1023 }); | 1028 }); |
| 1024 } | 1029 } |
| OLD | NEW |