| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // SharedOptions=--experimental-trust-js-interop-type-annotations | 5 // SharedOptions=--experimental-trust-js-interop-type-annotations |
| 6 | 6 |
| 7 // Same test as js_typed_interop_anonymous2, but using the | 7 // Same test as js_typed_interop_anonymous2, but using the |
| 8 // --experimental-trust-js-interop-type-annotations flag. | 8 // --experimental-trust-js-interop-type-annotations flag. |
| 9 @JS() | 9 @JS() |
| 10 library js_typed_interop_anonymous2_exp_test; | 10 library js_typed_interop_anonymous2_exp_test; |
| 11 | 11 |
| 12 import 'dart:html'; | 12 import 'dart:html'; |
| 13 import 'dart:js' as js; | 13 import 'dart:js' as js; |
| 14 | 14 |
| 15 import 'package:js/js.dart'; | 15 import 'package:js/js.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 16 import 'package:minitest/minitest.dart'; |
| 17 import 'package:unittest/html_config.dart'; | |
| 18 | 17 |
| 19 @JS() @anonymous | 18 @JS() @anonymous |
| 20 class A { | 19 class A { |
| 21 external factory A({B b}); | 20 external factory A({B b}); |
| 22 | 21 |
| 23 external B get b; | 22 external B get b; |
| 24 } | 23 } |
| 25 | 24 |
| 26 @JS() @anonymous | 25 @JS() @anonymous |
| 27 class B { | 26 class B { |
| 28 external factory B({C c}); | 27 external factory B({C c}); |
| 29 | 28 |
| 30 external C get c; | 29 external C get c; |
| 31 } | 30 } |
| 32 | 31 |
| 33 @JS() @anonymous | 32 @JS() @anonymous |
| 34 class C { | 33 class C { |
| 35 external factory C(); | 34 external factory C(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 // D is unreachable, and that is OK | 37 // D is unreachable, and that is OK |
| 39 @JS() @anonymous | 38 @JS() @anonymous |
| 40 class D { | 39 class D { |
| 41 external factory D(); | 40 external factory D(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 main() { | 43 main() { |
| 45 useHtmlConfiguration(); | |
| 46 | |
| 47 test('simple', () { | 44 test('simple', () { |
| 48 var b = new B(); | 45 var b = new B(); |
| 49 var a = new A(b: b); | 46 var a = new A(b: b); |
| 50 expect(a.b, equals(b)); | 47 expect(a.b, equals(b)); |
| 51 expect(b.c, isNull); | 48 expect(b.c, isNull); |
| 52 }); | 49 }); |
| 53 } | 50 } |
| OLD | NEW |