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

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

Issue 132403010: big update to observe, template_binding, polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
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 'dart:async';
7 import 'package:observe/observe.dart'; 8 import 'package:observe/observe.dart';
9 import 'package:unittest/unittest.dart';
10 export 'package:observe/src/dirty_check.dart' show dirtyCheckZone;
8 11
9 import 'package:unittest/unittest.dart'; 12 /// A small method to help readability. Used to cause the next "then" in a chain
10 13 /// to happen in the next microtask:
11 import 'package:observe/src/microtask.dart'; 14 ///
12 export 'package:observe/src/microtask.dart'; 15 /// future.then(newMicrotask).then(...)
16 newMicrotask(_) => new Future.value();
13 17
14 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords. 18 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords.
15 // For now just use the toString. 19 // For now just use the toString.
16 expectChanges(actual, expected, {reason}) => 20 expectChanges(actual, expected, {reason}) =>
17 expect('$actual', '$expected', reason: reason); 21 expect('$actual', '$expected', reason: reason);
18 22
19 List getListChangeRecords(List changes, int index) => changes 23 List getListChangeRecords(List changes, int index) => changes
20 .where((c) => c.indexChanged(index)).toList(); 24 .where((c) => c.indexChanged(index)).toList();
21 25
22 List getPropertyChangeRecords(List changes, Symbol property) => changes 26 List getPropertyChangeRecords(List changes, Symbol property) => changes
23 .where((c) => c is PropertyChangeRecord && c.name == property).toList(); 27 .where((c) => c is PropertyChangeRecord && c.name == property).toList();
24
25 /**
26 * This is a special kind of unit [test], that supports
27 * calling [performMicrotaskCheckpoint] during the test to pump events
28 * that original from observable objects.
29 */
30 observeTest(name, testCase) => test(name, wrapMicrotask(testCase));
31
32 /** The [solo_test] version of [observeTest]. */
33 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698