| 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 custom_element_bindings_test; | 5 library custom_element_bindings_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:mdv_observe/mdv_observe.dart'; | 9 import 'package:mdv_observe/mdv_observe.dart'; |
| 10 import 'package:unittest/html_config.dart'; | 10 import 'package:unittest/html_config.dart'; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 void unbindAll() => real.unbindAll(); | 254 void unbindAll() => real.unbindAll(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 // TODO(jmesserly): would be nice to use mocks when mirrors work on dart2js. | 257 // TODO(jmesserly): would be nice to use mocks when mirrors work on dart2js. |
| 258 class AttributeMapWrapper<K, V> implements Map<K, V> { | 258 class AttributeMapWrapper<K, V> implements Map<K, V> { |
| 259 final List log = []; | 259 final List log = []; |
| 260 Map<K, V> _map; | 260 Map<K, V> _map; |
| 261 | 261 |
| 262 AttributeMapWrapper(this._map); | 262 AttributeMapWrapper(this._map); |
| 263 | 263 |
| 264 bool containsValue(V value) => _map.containsValue(value); | 264 bool containsValue(Object value) => _map.containsValue(value); |
| 265 bool containsKey(K key) => _map.containsKey(key); | 265 bool containsKey(Object key) => _map.containsKey(key); |
| 266 V operator [](K key) => _map[key]; | 266 V operator [](Object key) => _map[key]; |
| 267 | 267 |
| 268 void operator []=(K key, V value) { | 268 void operator []=(K key, V value) { |
| 269 log.add(['[]=', key, value]); | 269 log.add(['[]=', key, value]); |
| 270 _map[key] = value; | 270 _map[key] = value; |
| 271 } | 271 } |
| 272 | 272 |
| 273 V putIfAbsent(K key, V ifAbsent()) => _map.putIfAbsent(key, ifAbsent); | 273 V putIfAbsent(K key, V ifAbsent()) => _map.putIfAbsent(key, ifAbsent); |
| 274 | 274 |
| 275 V remove(K key) { | 275 V remove(Object key) { |
| 276 log.add(['remove', key]); | 276 log.add(['remove', key]); |
| 277 _map.remove(key); | 277 _map.remove(key); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void clear() => _map.clear(); | 280 void clear() => _map.clear(); |
| 281 void forEach(void f(K key, V value)) => _map.forEach(f); | 281 void forEach(void f(K key, V value)) => _map.forEach(f); |
| 282 Iterable<K> get keys => _map.keys; | 282 Iterable<K> get keys => _map.keys; |
| 283 Iterable<V> get values => _map.values; | 283 Iterable<V> get values => _map.values; |
| 284 int get length => _map.length; | 284 int get length => _map.length; |
| 285 bool get isEmpty => _map.isEmpty; | 285 bool get isEmpty => _map.isEmpty; |
| 286 bool get isNotEmpty => _map.isNotEmpty; | 286 bool get isNotEmpty => _map.isNotEmpty; |
| 287 } | 287 } |
| OLD | NEW |