Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: pkg/observe/test/observable_list_test.dart

Issue 18267005: Fix bug in pkg:observe (observable_list.remove(Object)) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/observe/lib/src/observable_list.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/observable_list.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698