| Index: tests/html/js_test.dart
|
| diff --git a/tests/html/js_test.dart b/tests/html/js_test.dart
|
| index 081ab0270576c4bd3a86d22885eae90a21c73fba..7bdee2d50c520bb1f676125f6b07b8817bbf4b56 100644
|
| --- a/tests/html/js_test.dart
|
| +++ b/tests/html/js_test.dart
|
| @@ -228,6 +228,8 @@ class Callable {
|
| call() => 'called';
|
| }
|
|
|
| +typedef ThreeArgFunction(a, b, c);
|
| +
|
| main() {
|
| _injectJs();
|
| useHtmlConfiguration();
|
| @@ -659,6 +661,20 @@ main() {
|
| context.deleteProperty('callback');
|
| });
|
|
|
| + test('invoke Dart callback from JS in a Zone', () {
|
| + expect(() => context.callMethod('invokeCallback'), throws);
|
| +
|
| + var childZone = Zone.current.fork();
|
| + childZone.run(() {
|
| + context['callback'] = () {
|
| + expect(Zone.current, childZone);
|
| + };
|
| + });
|
| + context.callMethod('invokeCallback');
|
| +
|
| + context.deleteProperty('callback');
|
| + });
|
| +
|
| test('callback as parameter', () {
|
| expect(context.callMethod('getTypeOf', [context['razzle']]),
|
| equals("function"));
|
| @@ -694,6 +710,13 @@ main() {
|
| context.deleteProperty('callable');
|
| });
|
|
|
| + test('Dart closures should survive a round-trip to JS', () {
|
| + context['callback'] = (a, b, c) => a + b + c;
|
| + var f = context['callback'];
|
| + expect(f, new isInstanceOf<ThreeArgFunction>());
|
| + context.deleteProperty('callback');
|
| + });
|
| +
|
| });
|
|
|
| group('JsObject.jsify()', () {
|
|
|