Index: tests/lib_strong/html/js_test.dart |
diff --git a/tests/lib_strong/html/js_test.dart b/tests/lib_strong/html/js_test.dart |
index c55b926e79f5c892ef14a6e6dce8f24021b94320..1e0cc202036d73ae15a834a0df1533adcf9084cd 100644 |
--- a/tests/lib_strong/html/js_test.dart |
+++ b/tests/lib_strong/html/js_test.dart |
@@ -229,7 +229,6 @@ main() { |
_injectJs(); |
group('identity', () { |
- |
test('context instances should be identical', () { |
var c1 = context; |
var c2 = context; |
@@ -293,11 +292,9 @@ main() { |
expect(obj['role'], equals('object')); |
}); |
}); |
- |
}); |
group('context', () { |
- |
test('read global field', () { |
expect(context['x'], equals(42)); |
expect(context['y'], isNull); |
@@ -312,11 +309,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)); |
@@ -358,8 +353,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)); |
}); |
@@ -372,8 +367,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)); |
}); |
@@ -428,7 +422,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); |
} |
@@ -437,7 +432,6 @@ main() { |
}); |
group('JsFunction and callMethod', () { |
- |
test('new JsObject can return a JsFunction', () { |
var f = new JsObject(context['Function']); |
expect(f is JsFunction, isTrue); |
@@ -459,7 +453,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', () { |
@@ -479,7 +473,6 @@ main() { |
}); |
group('JsArray', () { |
- |
test('new JsArray()', () { |
var array = new JsArray(); |
var arrayType = context['Array']; |
@@ -499,8 +492,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 is JsArray, isTrue); |
expect(a, [1, 2, 3]); |
@@ -524,7 +518,7 @@ main() { |
expect(() => array[2], throwsRangeError); |
}); |
- test('[]=', () { |
+ test('[]=', () { |
var array = new JsArray<Object>.from([1, 2]); |
array[0] = 'd'; |
array[1] = 'e'; |
@@ -544,7 +538,7 @@ main() { |
expect(array, [1, 2, null]); |
}); |
- test('add', () { |
+ test('add', () { |
var array = new JsArray(); |
array.add('a'); |
expect(array, ['a']); |
@@ -617,11 +611,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]); |
@@ -636,7 +628,6 @@ main() { |
expect(() => new JsObject.fromBrowserObject(v), throwsArgumentError); |
} |
}); |
- |
}); |
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', () { |
dynamic object = { |
- 'a': [1, [2, 3]], |
+ 'a': [ |
+ 1, |
+ [2, 3] |
+ ], |
'b': { |
'c': 3, |
'd': new JsObject(context['Foo'], [42]) |
@@ -749,7 +744,6 @@ main() { |
}); |
group('JsObject_methods', () { |
- |
test('hashCode and ==', () { |
final o1 = context['Object']; |
final o2 = context['Object']; |
@@ -836,9 +830,7 @@ main() { |
}); |
group('transferrables', () { |
- |
group('JS->Dart', () { |
- |
test('DateTime', () { |
var date = context.callMethod('getNewDate'); |
expect(date is DateTime, isTrue); |
@@ -891,9 +883,11 @@ main() { |
foreignDoc.callMethod('createElement', ['div']); |
var typedContentWindow = js_util.getProperty(iframe, 'contentWindow'); |
- var typedForeignDoc = js_util.getProperty(typedContentWindow, 'document'); |
+ var typedForeignDoc = |
+ js_util.getProperty(typedContentWindow, 'document'); |
- var typedForeignFunction = js_util.getProperty(typedForeignDoc, 'createElement'); |
+ var typedForeignFunction = |
+ js_util.getProperty(typedForeignDoc, 'createElement'); |
expect(typedForeignFunction is Function, isTrue); |
js_util.callMethod(typedForeignDoc, 'createElement', ['div']); |
}); |
@@ -938,11 +932,9 @@ main() { |
expect(list, equals([1, 2, 3, 4, 5, 6, 7, 8])); |
} |
}); |
- |
}); |
group('Dart->JS', () { |
- |
test('Date', () { |
context['o'] = new DateTime(1995, 12, 17); |
var dateType = context['Date']; |
@@ -979,8 +971,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'); |
}); |
@@ -996,7 +988,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'); |
} |
@@ -1026,8 +1019,6 @@ main() { |
context.deleteProperty('o'); |
} |
}); |
- |
}); |
}); |
- |
} |