| Index: tests/html/js_test.dart
|
| diff --git a/tests/html/js_test.dart b/tests/html/js_test.dart
|
| index c429cd89bec50d0a4e702eb227b0d982708ae8ad..2141ee4a7ea3d36d8b2e1ece379f8d9b103999f8 100644
|
| --- a/tests/html/js_test.dart
|
| +++ b/tests/html/js_test.dart
|
| @@ -235,7 +235,6 @@ main() {
|
| useHtmlIndividualConfiguration();
|
|
|
| group('identity', () {
|
| -
|
| test('context instances should be identical', () {
|
| var c1 = context;
|
| var c2 = context;
|
| @@ -299,11 +298,9 @@ main() {
|
| expect(obj['role'], equals('object'));
|
| });
|
| });
|
| -
|
| });
|
|
|
| group('context', () {
|
| -
|
| test('read global field', () {
|
| expect(context['x'], equals(42));
|
| expect(context['y'], isNull);
|
| @@ -318,11 +315,9 @@ main() {
|
| context['y'] = 42;
|
| expect(context['y'], equals(42));
|
| });
|
| -
|
| });
|
|
|
| group('new_JsObject', () {
|
| -
|
| test('new Foo()', () {
|
| var foo = new JsObject(context['Foo'], [42]);
|
| expect(foo['a'], equals(42));
|
| @@ -364,8 +359,8 @@ main() {
|
| });
|
|
|
| test('new Date("December 17, 1995 03:24:00 GMT")', () {
|
| - final a = new JsObject(context['Date'],
|
| - ["December 17, 1995 03:24:00 GMT"]);
|
| + final a =
|
| + new JsObject(context['Date'], ["December 17, 1995 03:24:00 GMT"]);
|
| expect(a.callMethod('getTime'), equals(819170640000));
|
| });
|
|
|
| @@ -378,8 +373,7 @@ main() {
|
|
|
| test('new Date(1995,11,17,3,24,0)', () {
|
| // Note: JS Date counts months from 0 while Dart counts from 1.
|
| - final a = new JsObject(context['Date'],
|
| - [1995, 11, 17, 3, 24, 0]);
|
| + final a = new JsObject(context['Date'], [1995, 11, 17, 3, 24, 0]);
|
| final b = new DateTime(1995, 12, 17, 3, 24, 0);
|
| expect(a.callMethod('getTime'), equals(b.millisecondsSinceEpoch));
|
| });
|
| @@ -434,7 +428,8 @@ main() {
|
| });
|
|
|
| test('>10 parameters', () {
|
| - final o = new JsObject(context['Baz'], [1,2,3,4,5,6,7,8,9,10,11]);
|
| + final o =
|
| + new JsObject(context['Baz'], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
|
| for (var i = 1; i <= 11; i++) {
|
| expect(o["f$i"], i);
|
| }
|
| @@ -443,7 +438,6 @@ main() {
|
| });
|
|
|
| group('JsFunction and callMethod', () {
|
| -
|
| test('new JsObject can return a JsFunction', () {
|
| var f = new JsObject(context['Function']);
|
| expect(f, new isInstanceOf<JsFunction>());
|
| @@ -465,7 +459,7 @@ main() {
|
|
|
| test('callMethod with many arguments', () {
|
| expect(context.callMethod('varArgs', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
|
| - equals(55));
|
| + equals(55));
|
| });
|
|
|
| test('access a property of a function', () {
|
| @@ -485,7 +479,6 @@ main() {
|
| });
|
|
|
| group('JsArray', () {
|
| -
|
| test('new JsArray()', () {
|
| var array = new JsArray();
|
| var arrayType = context['Array'];
|
| @@ -505,8 +498,9 @@ main() {
|
|
|
| test('get Array from JS', () {
|
| context['a'] = new JsObject(context['Array'], [1, 2, 3]);
|
| - expect(context.callMethod('isPropertyInstanceOf',
|
| - ['a', context['Array']]), isTrue);
|
| + expect(
|
| + context.callMethod('isPropertyInstanceOf', ['a', context['Array']]),
|
| + isTrue);
|
| var a = context['a'];
|
| expect(a, new isInstanceOf<JsArray>());
|
| expect(a, [1, 2, 3]);
|
| @@ -530,7 +524,7 @@ main() {
|
| expect(() => array[2], throwsA(isRangeError));
|
| });
|
|
|
| - test('[]=', () {
|
| + test('[]=', () {
|
| var array = new JsArray.from([1, 2]);
|
| array[0] = 'd';
|
| array[1] = 'e';
|
| @@ -550,7 +544,7 @@ main() {
|
| expect(array, [1, 2, null]);
|
| });
|
|
|
| - test('add', () {
|
| + test('add', () {
|
| var array = new JsArray();
|
| array.add('a');
|
| expect(array, ['a']);
|
| @@ -623,11 +617,9 @@ main() {
|
| array.sort((a, b) => -(a.compareTo(b)));
|
| expect(array, ['c', 'b', 'a']);
|
| });
|
| -
|
| });
|
|
|
| group('JsObject.fromBrowserObject()', () {
|
| -
|
| test('Nodes are proxied', () {
|
| var node = new JsObject.fromBrowserObject(new DivElement());
|
| context.callMethod('addTestProperty', [node]);
|
| @@ -643,7 +635,6 @@ main() {
|
| throwsA(new isInstanceOf<ArgumentError>()));
|
| }
|
| });
|
| -
|
| });
|
|
|
| group('Dart_functions', () {
|
| @@ -673,14 +664,17 @@ main() {
|
| });
|
|
|
| test('invoke Dart callback from JS with 11 parameters', () {
|
| - context['callbackWith11params'] = (p1, p2, p3, p4, p5, p6, p7,
|
| - p8, p9, p10, p11) => '$p1$p2$p3$p4$p5$p6$p7$p8$p9$p10$p11';
|
| + context['callbackWith11params'] =
|
| + (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) =>
|
| + '$p1$p2$p3$p4$p5$p6$p7$p8$p9$p10$p11';
|
| expect(context.callMethod('invokeCallbackWith11params'),
|
| equals('1234567891011'));
|
| });
|
|
|
| test('return a JS proxy to JavaScript', () {
|
| - var result = context.callMethod('testJsMap', [() => new JsObject.jsify({'value': 42})]);
|
| + var result = context.callMethod('testJsMap', [
|
| + () => new JsObject.jsify({'value': 42})
|
| + ]);
|
| expect(result, 42);
|
| });
|
|
|
| @@ -690,17 +684,15 @@ main() {
|
| expect(result, 'called');
|
| context.deleteProperty('callable');
|
| });
|
| -
|
| });
|
|
|
| group('JsObject.jsify()', () {
|
| -
|
| test('convert a List', () {
|
| final list = [1, 2, 3, 4, 5, 6, 7, 8];
|
| var array = new JsObject.jsify(list);
|
| expect(context.callMethod('isArray', [array]), isTrue);
|
| expect(array['length'], equals(list.length));
|
| - for (var i = 0; i < list.length ; i++) {
|
| + for (var i = 0; i < list.length; i++) {
|
| expect(array[i], equals(list[i]));
|
| }
|
| });
|
| @@ -710,7 +702,7 @@ main() {
|
| var array = new JsObject.jsify(set);
|
| expect(context.callMethod('isArray', [array]), isTrue);
|
| expect(array['length'], equals(set.length));
|
| - for (var i = 0; i < array['length'] ; i++) {
|
| + for (var i = 0; i < array['length']; i++) {
|
| expect(set.contains(array[i]), isTrue);
|
| }
|
| });
|
| @@ -726,7 +718,10 @@ main() {
|
|
|
| test('deep convert a complex object', () {
|
| final object = {
|
| - 'a': [1, [2, 3]],
|
| + 'a': [
|
| + 1,
|
| + [2, 3]
|
| + ],
|
| 'b': {
|
| 'c': 3,
|
| 'd': new JsObject(context['Foo'], [42])
|
| @@ -750,7 +745,6 @@ main() {
|
| });
|
|
|
| group('JsObject_methods', () {
|
| -
|
| test('hashCode and ==', () {
|
| final o1 = context['Object'];
|
| final o2 = context['Object'];
|
| @@ -837,9 +831,7 @@ main() {
|
| });
|
|
|
| group('transferrables', () {
|
| -
|
| group('JS->Dart', () {
|
| -
|
| test('DateTime', () {
|
| var date = context.callMethod('getNewDate');
|
| expect(date is DateTime, isTrue);
|
| @@ -919,7 +911,6 @@ main() {
|
| expect(list, orderedEquals([1, 2, 3, 4, 5, 6, 7, 8]));
|
| }
|
| });
|
| -
|
| });
|
|
|
| group('JavaScriptFunction', () {
|
| @@ -934,7 +925,6 @@ main() {
|
| });
|
|
|
| group('Dart->JS', () {
|
| -
|
| test('Date', () {
|
| context['o'] = new DateTime(1995, 12, 17);
|
| var dateType = context['Date'];
|
| @@ -971,8 +961,8 @@ main() {
|
| test('unattached DivElement', () {
|
| context['o'] = new DivElement();
|
| var divType = context['HTMLDivElement'];
|
| - expect(context.callMethod('isPropertyInstanceOf', ['o', divType]),
|
| - isTrue);
|
| + expect(
|
| + context.callMethod('isPropertyInstanceOf', ['o', divType]), isTrue);
|
| context.deleteProperty('o');
|
| });
|
|
|
| @@ -988,7 +978,8 @@ main() {
|
| if (IdbFactory.supported) {
|
| context['o'] = new KeyRange.only(1);
|
| var keyRangeType = context['IDBKeyRange'];
|
| - expect(context.callMethod('isPropertyInstanceOf', ['o', keyRangeType]),
|
| + expect(
|
| + context.callMethod('isPropertyInstanceOf', ['o', keyRangeType]),
|
| isTrue);
|
| context.deleteProperty('o');
|
| }
|
| @@ -1018,8 +1009,6 @@ main() {
|
| context.deleteProperty('o');
|
| }
|
| });
|
| -
|
| });
|
| });
|
| -
|
| }
|
|
|