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:typed_data' show ByteBuffer, Int32List; | 9 import 'dart:typed_data' show ByteBuffer, Int32List; |
10 import 'dart:indexed_db' show IdbFactory, KeyRange; | 10 import 'dart:indexed_db' show IdbFactory, KeyRange; |
11 import 'dart:js'; | 11 import 'dart:js'; |
12 | 12 |
13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
14 import 'package:unittest/html_config.dart'; | 14 import 'package:unittest/html_individual_config.dart'; |
15 | 15 |
16 _injectJs() { | 16 _injectJs() { |
17 final script = new ScriptElement(); | 17 final script = new ScriptElement(); |
18 script.type = 'text/javascript'; | 18 script.type = 'text/javascript'; |
19 script.innerHtml = r""" | 19 script.innerHtml = r""" |
20 var x = 42; | 20 var x = 42; |
21 | 21 |
22 var _x = 123; | 22 var _x = 123; |
23 | 23 |
24 var myArray = ["value1"]; | 24 var myArray = ["value1"]; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 class TestDartObject {} | 225 class TestDartObject {} |
226 | 226 |
227 class Callable { | 227 class Callable { |
228 call() => 'called'; | 228 call() => 'called'; |
229 } | 229 } |
230 | 230 |
231 main() { | 231 main() { |
232 _injectJs(); | 232 _injectJs(); |
233 useHtmlConfiguration(); | 233 useHtmlIndividualConfiguration(); |
234 | 234 |
235 group('identity', () { | 235 group('identity', () { |
236 | 236 |
237 test('context instances should be identical', () { | 237 test('context instances should be identical', () { |
238 var c1 = context; | 238 var c1 = context; |
239 var c2 = context; | 239 var c2 = context; |
240 expect(identical(c1, c2), isTrue); | 240 expect(identical(c1, c2), isTrue); |
241 }); | 241 }); |
242 | 242 |
243 /* | 243 /* |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 test('length', () { | 545 test('length', () { |
546 var array = new JsArray.from([1, 2, 3]); | 546 var array = new JsArray.from([1, 2, 3]); |
547 expect(array.length, 3); | 547 expect(array.length, 3); |
548 array.add(4); | 548 array.add(4); |
549 expect(array.length, 4); | 549 expect(array.length, 4); |
550 array.length = 2; | 550 array.length = 2; |
551 expect(array, [1, 2]); | 551 expect(array, [1, 2]); |
552 array.length = 3; | 552 array.length = 3; |
553 expect(array, [1, 2, null]); | 553 expect(array, [1, 2, null]); |
554 }); | 554 }); |
555 | 555 |
556 test('add', () { | 556 test('add', () { |
557 var array = new JsArray(); | 557 var array = new JsArray(); |
558 array.add('a'); | 558 array.add('a'); |
559 expect(array, ['a']); | 559 expect(array, ['a']); |
560 array.add('b'); | 560 array.add('b'); |
561 expect(array, ['a', 'b']); | 561 expect(array, ['a', 'b']); |
562 }); | 562 }); |
563 | 563 |
564 test('addAll', () { | 564 test('addAll', () { |
565 var array = new JsArray(); | 565 var array = new JsArray(); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), | 1005 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), |
1006 // isTrue); | 1006 // isTrue); |
1007 context.deleteProperty('o'); | 1007 context.deleteProperty('o'); |
1008 } | 1008 } |
1009 }); | 1009 }); |
1010 | 1010 |
1011 }); | 1011 }); |
1012 }); | 1012 }); |
1013 | 1013 |
1014 } | 1014 } |
OLD | NEW |