| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:observe/observe.dart'; | 6 import 'package:observe/observe.dart'; |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'observe_test_utils.dart'; | 8 import 'observe_test_utils.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 _change(1, addedCount: 1), | 246 _change(1, addedCount: 1), |
| 247 _change(4, removed: [1]) | 247 _change(4, removed: [1]) |
| 248 ]); | 248 ]); |
| 249 }); | 249 }); |
| 250 | 250 |
| 251 observeTest('clear', () { | 251 observeTest('clear', () { |
| 252 list.clear(); | 252 list.clear(); |
| 253 expect(list, []); | 253 expect(list, []); |
| 254 | 254 |
| 255 performMicrotaskCheckpoint(); | 255 performMicrotaskCheckpoint(); |
| 256 expectChanges(propRecords, [_lengthChange(6, 0)]); | 256 expectChanges(propRecords, [ |
| 257 _lengthChange(6, 0), |
| 258 new PropertyChangeRecord(list, #isEmpty, false, true), |
| 259 new PropertyChangeRecord(list, #isNotEmpty, true, false), |
| 260 ]); |
| 257 expectChanges(listRecords, [_change(0, removed: [1, 2, 3, 1, 3, 4])]); | 261 expectChanges(listRecords, [_change(0, removed: [1, 2, 3, 1, 3, 4])]); |
| 258 }); | 262 }); |
| 259 }); | 263 }); |
| 260 } | 264 } |
| 261 | 265 |
| 262 ObservableList list; | 266 ObservableList list; |
| 263 | 267 |
| 264 _lengthChange(int oldValue, int newValue) => | 268 _lengthChange(int oldValue, int newValue) => |
| 265 new PropertyChangeRecord(list, #length, oldValue, newValue); | 269 new PropertyChangeRecord(list, #length, oldValue, newValue); |
| 266 | 270 |
| 267 _change(index, {removed: const [], addedCount: 0}) => new ListChangeRecord( | 271 _change(index, {removed: const [], addedCount: 0}) => new ListChangeRecord( |
| 268 list, index, removed: removed, addedCount: addedCount); | 272 list, index, removed: removed, addedCount: addedCount); |
| OLD | NEW |