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_test; | 6 library js_typed_interop_test; |
7 | 7 |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 | 9 |
10 import 'package:js/js.dart'; | 10 import 'package:js/js.dart'; |
11 import 'package:minitest/minitest.dart'; | 11 import 'package:expect/minitest.dart'; |
12 | 12 |
13 _injectJs() { | 13 _injectJs() { |
14 document.body.append(new ScriptElement() | 14 document.body.append(new ScriptElement() |
15 ..type = 'text/javascript' | 15 ..type = 'text/javascript' |
16 ..innerHtml = r""" | 16 ..innerHtml = r""" |
17 var Foo = { | 17 var Foo = { |
18 get42: function(b) { return arguments.length >= 1 ? b : 42; }, | 18 get42: function(b) { return arguments.length >= 1 ? b : 42; }, |
19 get43: function(b) { return arguments.length >= 1 ? b : 43; } | 19 get43: function(b) { return arguments.length >= 1 ? b : 43; } |
20 }; | 20 }; |
21 """); | 21 """); |
(...skipping 24 matching lines...) Expand all Loading... |
46 test('call tearoff from dart with default', () { | 46 test('call tearoff from dart with default', () { |
47 var f = Foo.get42; | 47 var f = Foo.get42; |
48 // Note: today both SSA and CPS remove the extra argument on static calls, | 48 // Note: today both SSA and CPS remove the extra argument on static calls, |
49 // but they fail to do so on tearoffs. | 49 // but they fail to do so on tearoffs. |
50 expect(f(), 3); /// default_value: continued | 50 expect(f(), 3); /// default_value: continued |
51 | 51 |
52 f = Foo.get43; | 52 f = Foo.get43; |
53 expect(f(), 43); | 53 expect(f(), 43); |
54 }); | 54 }); |
55 } | 55 } |
OLD | NEW |