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 @JS() | 5 @JS() |
6 library js_typed_interop_anonymous2_test; | 6 library js_typed_interop_anonymous2_test; |
7 | 7 |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:js' as js; | 9 import 'dart:js' as js; |
10 | 10 |
11 import 'package:js/js.dart'; | 11 import 'package:js/js.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:minitest/minitest.dart'; |
13 import 'package:unittest/html_config.dart'; | |
14 | 13 |
15 @JS() @anonymous | 14 @JS() @anonymous |
16 class A { | 15 class A { |
17 external factory A({B b}); | 16 external factory A({B b}); |
18 | 17 |
19 external B get b; | 18 external B get b; |
20 } | 19 } |
21 | 20 |
22 @JS() @anonymous | 21 @JS() @anonymous |
23 class B { | 22 class B { |
24 external factory B({C c}); | 23 external factory B({C c}); |
25 | 24 |
26 external C get c; | 25 external C get c; |
27 } | 26 } |
28 | 27 |
29 @JS() @anonymous | 28 @JS() @anonymous |
30 class C { | 29 class C { |
31 external factory C(); | 30 external factory C(); |
32 } | 31 } |
33 | 32 |
34 // D is unreachable, and that is OK | 33 // D is unreachable, and that is OK |
35 @JS() @anonymous | 34 @JS() @anonymous |
36 class D { | 35 class D { |
37 external factory D(); | 36 external factory D(); |
38 } | 37 } |
39 | 38 |
40 main() { | 39 main() { |
41 useHtmlConfiguration(); | |
42 | |
43 test('simple', () { | 40 test('simple', () { |
44 var b = new B(); | 41 var b = new B(); |
45 var a = new A(b: b); | 42 var a = new A(b: b); |
46 expect(a.b, equals(b)); | 43 expect(a.b, equals(b)); |
47 expect(b.c, isNull); | 44 expect(b.c, isNull); |
48 }); | 45 }); |
49 } | 46 } |
OLD | NEW |