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 @TestOn('browser') | 4 @TestOn('browser') |
5 library polymer_elements.test.iron_meta_test; | 5 library polymer_elements.test.iron_meta_test; |
6 | 6 |
| 7 import 'dart:js'; |
7 import 'package:polymer_elements/iron_meta.dart'; | 8 import 'package:polymer_elements/iron_meta.dart'; |
8 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
9 import 'package:web_components/web_components.dart'; | 10 import 'package:web_components/web_components.dart'; |
10 import 'common.dart'; | 11 import 'common.dart'; |
11 | 12 |
12 main() async { | 13 main() async { |
13 await initWebComponents(); | 14 await initWebComponents(); |
14 | 15 |
15 group('<iron-meta>', () { | 16 group('<iron-meta>', () { |
16 group('basic behavior', () { | 17 group('basic behavior', () { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 test('let the last value win registration against the key', () { | 132 test('let the last value win registration against the key', () { |
132 var registeredValue = metaPair[0].byKey(metaPair[0].key); | 133 var registeredValue = metaPair[0].byKey(metaPair[0].key); |
133 var firstValue = metaPair[0].value; | 134 var firstValue = metaPair[0].value; |
134 var secondValue = metaPair[1].value; | 135 var secondValue = metaPair[1].value; |
135 | 136 |
136 expect(registeredValue, isNot(firstValue)); | 137 expect(registeredValue, isNot(firstValue)); |
137 expect(registeredValue, secondValue); | 138 expect(registeredValue, secondValue); |
138 }); | 139 }); |
139 }); | 140 }); |
| 141 |
| 142 group('singleton', () { |
| 143 |
| 144 test('only one ironmeta created', () { |
| 145 var ironMeta = context['Polymer']['IronMeta']; |
| 146 var first = ironMeta.callMethod('getIronMeta'); |
| 147 var second = ironMeta.callMethod('getIronMeta'); |
| 148 expect(first, second); |
| 149 }); |
| 150 }); |
140 }); | 151 }); |
141 } | 152 } |
OLD | NEW |