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

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

Issue 53683004: fix observe tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/test/list_change_test.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 '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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 observeTest('clear changes length', () { 76 observeTest('clear changes length', () {
77 list.clear(); 77 list.clear();
78 expect(list, []); 78 expect(list, []);
79 performMicrotaskCheckpoint(); 79 performMicrotaskCheckpoint();
80 expectChanges(changes, [_lengthChange(3, 0)]); 80 expectChanges(changes, [_lengthChange(3, 0)]);
81 }); 81 });
82 }); 82 });
83 83
84 group('observe index', () { 84 group('observe index', () {
85 List<ChangeRecord> changes; 85 List<ListChangeRecord> changes;
86 86
87 setUp(() { 87 setUp(() {
88 list = toObservable([1, 2, 3]); 88 list = toObservable([1, 2, 3]);
89 changes = null; 89 changes = null;
90 sub = list.listChanges.listen((records) { 90 sub = list.listChanges.listen((records) {
91 changes = getListChangeRecords(records, 1); 91 changes = getListChangeRecords(records, 1);
92 }); 92 });
93 }); 93 });
94 94
95 tearDown(sharedTearDown); 95 tearDown(sharedTearDown);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 }); 158 });
159 }); 159 });
160 160
161 observeTest('toString', () { 161 observeTest('toString', () {
162 var list = toObservable([1, 2, 3]); 162 var list = toObservable([1, 2, 3]);
163 expect(list.toString(), '[1, 2, 3]'); 163 expect(list.toString(), '[1, 2, 3]');
164 }); 164 });
165 165
166 group('change records', () { 166 group('change records', () {
167 167
168 List<PropertyChangeRecord> propRecords; 168 List<ChangeRecord> propRecords;
169 List<ListChangeRecord> listRecords; 169 List<ListChangeRecord> listRecords;
170 170
171 setUp(() { 171 setUp(() {
172 list = toObservable([1, 2, 3, 1, 3, 4]); 172 list = toObservable([1, 2, 3, 1, 3, 4]);
173 propRecords = null; 173 propRecords = null;
174 listRecords = null; 174 listRecords = null;
175 sub = list.changes.listen((r) { propRecords = r; }); 175 sub = list.changes.listen((r) { propRecords = r; });
176 sub2 = list.listChanges.listen((r) { listRecords = r; }); 176 sub2 = list.listChanges.listen((r) { listRecords = r; });
177 }); 177 });
178 178
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 }); 259 });
260 } 260 }
261 261
262 ObservableList list; 262 ObservableList list;
263 263
264 _lengthChange(int oldValue, int newValue) => 264 _lengthChange(int oldValue, int newValue) =>
265 new PropertyChangeRecord(list, #length, oldValue, newValue); 265 new PropertyChangeRecord(list, #length, oldValue, newValue);
266 266
267 _change(index, {removed: const [], addedCount: 0}) => new ListChangeRecord( 267 _change(index, {removed: const [], addedCount: 0}) => new ListChangeRecord(
268 list, index, removed: removed, addedCount: addedCount); 268 list, index, removed: removed, addedCount: addedCount);
OLDNEW
« no previous file with comments | « pkg/observe/test/list_change_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698