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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 static final BLUE = new Color._("blue"); | 144 static final BLUE = new Color._("blue"); |
145 String _value; | 145 String _value; |
146 Color._(this._value); | 146 Color._(this._value); |
147 String toJs() => this._value; | 147 String toJs() => this._value; |
148 } | 148 } |
149 | 149 |
150 main() { | 150 main() { |
151 _injectJs(); | 151 _injectJs(); |
152 useHtmlConfiguration(); | 152 useHtmlConfiguration(); |
153 | 153 |
| 154 test('context instances should be identical', () { |
| 155 var c1 = context; |
| 156 var c2 = context; |
| 157 expect(identical(c1, c2), isTrue); |
| 158 }); |
| 159 |
154 test('read global field', () { | 160 test('read global field', () { |
155 expect(context['x'], equals(42)); | 161 expect(context['x'], equals(42)); |
156 expect(context['y'], isNull); | 162 expect(context['y'], isNull); |
157 }); | 163 }); |
158 | 164 |
159 test('read global field with underscore', () { | 165 test('read global field with underscore', () { |
160 expect(context['_x'], equals(123)); | 166 expect(context['_x'], equals(123)); |
161 expect(context['y'], isNull); | 167 expect(context['y'], isNull); |
162 }); | 168 }); |
163 | 169 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 context['dartDate'] = date; | 466 context['dartDate'] = date; |
461 expect(context['dartDate'], equals(date)); | 467 expect(context['dartDate'], equals(date)); |
462 }); | 468 }); |
463 | 469 |
464 test('usage of Serializable', () { | 470 test('usage of Serializable', () { |
465 final red = Color.RED; | 471 final red = Color.RED; |
466 context['color'] = red; | 472 context['color'] = red; |
467 expect(context['color'], equals(red._value)); | 473 expect(context['color'], equals(red._value)); |
468 }); | 474 }); |
469 } | 475 } |
OLD | NEW |