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

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

Issue 53743002: introduce ObservableList.listChanges to keep list changes separate from property changes (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/observable_list_test.dart ('k') | pkg/polymer/lib/src/instance.dart » ('j') | 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 library observe.test.observe_test_utils; 5 library observe.test.observe_test_utils;
6 6
7 import 'package:observe/observe.dart'; 7 import 'package:observe/observe.dart';
8 8
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import 'package:observe/src/microtask.dart'; 11 import 'package:observe/src/microtask.dart';
12 export 'package:observe/src/microtask.dart'; 12 export 'package:observe/src/microtask.dart';
13 13
14 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords. 14 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords.
15 // For now just use the toString. 15 // For now just use the toString.
16 expectChanges(actual, expected, {reason}) => 16 expectChanges(actual, expected, {reason}) =>
17 expect('$actual', '$expected', reason: reason); 17 expect('$actual', '$expected', reason: reason);
18 18
19 List getListChangeRecords(List changes, int index) => changes 19 List getListChangeRecords(List changes, int index) => changes
20 .where((c) => c is ListChangeRecord && c.indexChanged(index)).toList(); 20 .where((c) => c.indexChanged(index)).toList();
21 21
22 List getPropertyChangeRecords(List changes, Symbol property) => changes 22 List getPropertyChangeRecords(List changes, Symbol property) => changes
23 .where((c) => c is PropertyChangeRecord && c.name == property).toList(); 23 .where((c) => c is PropertyChangeRecord && c.name == property).toList();
24 24
25 /** 25 /**
26 * This is a special kind of unit [test], that supports 26 * This is a special kind of unit [test], that supports
27 * calling [performMicrotaskCheckpoint] during the test to pump events 27 * calling [performMicrotaskCheckpoint] during the test to pump events
28 * that original from observable objects. 28 * that original from observable objects.
29 */ 29 */
30 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); 30 observeTest(name, testCase) => test(name, wrapMicrotask(testCase));
31 31
32 /** The [solo_test] version of [observeTest]. */ 32 /** The [solo_test] version of [observeTest]. */
33 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase)); 33 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase));
OLDNEW
« no previous file with comments | « pkg/observe/test/observable_list_test.dart ('k') | pkg/polymer/lib/src/instance.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698