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_function_getter_test; | 6 library js_function_getter_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 bar = { }; | 17 var bar = { }; |
18 | 18 |
19 bar.instanceMember = function() { | 19 bar.instanceMember = function() { |
20 if (this !== bar) { | 20 if (this !== bar) { |
21 throw 'Unexpected this!'; | 21 throw 'Unexpected this!'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 expect(dynamicStatic(0), equals(1)); | 96 expect(dynamicStatic(0), equals(1)); |
97 expect(dynamicStatic(0,0), equals(2)); | 97 expect(dynamicStatic(0,0), equals(2)); |
98 expect(dynamicStatic(0,0,0,0,0,0), equals(6)); | 98 expect(dynamicStatic(0,0,0,0,0,0), equals(6)); |
99 }); | 99 }); |
100 | 100 |
101 test('typedef function', () { | 101 test('typedef function', () { |
102 expect(foo.bar.add(4,5), equals(9)); | 102 expect(foo.bar.add(4,5), equals(9)); |
103 }); | 103 }); |
104 }); | 104 }); |
105 } | 105 } |
OLD | NEW |