OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library jsTest; | 5 library jsTest; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:js'; | 9 import 'dart:js'; |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 main() { | 150 main() { |
151 _injectJs(); | 151 _injectJs(); |
152 useHtmlConfiguration(); | 152 useHtmlConfiguration(); |
153 | 153 |
154 test('context instances should be identical', () { | 154 test('context instances should be identical', () { |
155 var c1 = context; | 155 var c1 = context; |
156 var c2 = context; | 156 var c2 = context; |
157 expect(identical(c1, c2), isTrue); | 157 expect(identical(c1, c2), isTrue); |
158 }); | 158 }); |
159 | 159 |
| 160 test('identical JS objects should have identical proxies', () { |
| 161 var o1 = context['location']; |
| 162 var o2 = context['location']; |
| 163 expect(identical(o1, o2), isTrue); |
| 164 }); |
| 165 |
| 166 test('identical JS functions should have identical proxies', () { |
| 167 var f1 = context['Object']; |
| 168 var f2 = context['Object']; |
| 169 expect(identical(f1, f2), isTrue); |
| 170 }); |
| 171 |
160 test('read global field', () { | 172 test('read global field', () { |
161 expect(context['x'], equals(42)); | 173 expect(context['x'], equals(42)); |
162 expect(context['y'], isNull); | 174 expect(context['y'], isNull); |
163 }); | 175 }); |
164 | 176 |
165 test('read global field with underscore', () { | 177 test('read global field with underscore', () { |
166 expect(context['_x'], equals(123)); | 178 expect(context['_x'], equals(123)); |
167 expect(context['y'], isNull); | 179 expect(context['y'], isNull); |
168 }); | 180 }); |
169 | 181 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 context['dartDate'] = date; | 478 context['dartDate'] = date; |
467 expect(context['dartDate'], equals(date)); | 479 expect(context['dartDate'], equals(date)); |
468 }); | 480 }); |
469 | 481 |
470 test('usage of Serializable', () { | 482 test('usage of Serializable', () { |
471 final red = Color.RED; | 483 final red = Color.RED; |
472 context['color'] = red; | 484 context['color'] = red; |
473 expect(context['color'], equals(red._value)); | 485 expect(context['color'], equals(red._value)); |
474 }); | 486 }); |
475 } | 487 } |
OLD | NEW |