| 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 import 'package:observe/observe.dart'; | 5 import 'package:observe/observe.dart'; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'utils.dart'; | 7 import 'utils.dart'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 // TODO(jmesserly): need all standard List API tests. | 10 // TODO(jmesserly): need all standard List API tests. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }); | 24 }); |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 test('add changes length', () { | 27 test('add changes length', () { |
| 28 list.add(4); | 28 list.add(4); |
| 29 expect(list, [1, 2, 3, 4]); | 29 expect(list, [1, 2, 3, 4]); |
| 30 deliverChangeRecords(); | 30 deliverChangeRecords(); |
| 31 expectChanges(changes, [_lengthChange]); | 31 expectChanges(changes, [_lengthChange]); |
| 32 }); | 32 }); |
| 33 | 33 |
| 34 test('removeObject', () { |
| 35 list.remove(2); |
| 36 expect(list, orderedEquals([1, 3])); |
| 37 |
| 38 deliverChangeRecords(); |
| 39 deliverChangeRecords(); |
| 40 expectChanges(changes, [_lengthChange]); |
| 41 }); |
| 42 |
| 34 test('removeRange changes length', () { | 43 test('removeRange changes length', () { |
| 35 list.add(4); | 44 list.add(4); |
| 36 list.removeRange(1, 3); | 45 list.removeRange(1, 3); |
| 37 expect(list, [1, 4]); | 46 expect(list, [1, 4]); |
| 38 deliverChangeRecords(); | 47 deliverChangeRecords(); |
| 39 expectChanges(changes, [_lengthChange]); | 48 expectChanges(changes, [_lengthChange]); |
| 40 }); | 49 }); |
| 41 | 50 |
| 42 test('length= changes length', () { | 51 test('length= changes length', () { |
| 43 list.length = 5; | 52 list.length = 5; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 }); | 245 }); |
| 237 }); | 246 }); |
| 238 } | 247 } |
| 239 | 248 |
| 240 const _LENGTH = const Symbol('length'); | 249 const _LENGTH = const Symbol('length'); |
| 241 | 250 |
| 242 final _lengthChange = new PropertyChangeRecord(_LENGTH); | 251 final _lengthChange = new PropertyChangeRecord(_LENGTH); |
| 243 | 252 |
| 244 _change(index, {removedCount: 0, addedCount: 0}) => new ListChangeRecord( | 253 _change(index, {removedCount: 0, addedCount: 0}) => new ListChangeRecord( |
| 245 index, removedCount: removedCount, addedCount: addedCount); | 254 index, removedCount: removedCount, addedCount: addedCount); |
| OLD | NEW |