OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library observable.test.observable_test_utils; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:observable/observable.dart'; |
| 10 import 'package:test/test.dart'; |
| 11 |
| 12 /// A small method to help readability. Used to cause the next "then" in a chain |
| 13 /// to happen in the next microtask: |
| 14 /// |
| 15 /// future.then(newMicrotask).then(...) |
| 16 /// |
| 17 /// Uses [mu]. |
| 18 newMicrotask(_) => new Future.value(); |
| 19 |
| 20 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords. |
| 21 // For now just use the toString. |
| 22 void expectChanges(actual, expected, {String reason}) => |
| 23 expect('$actual', '$expected', reason: reason); |
| 24 |
| 25 List<ListChangeRecord> getListChangeRecords( |
| 26 List<ListChangeRecord> changes, int index) => |
| 27 new List.from(changes.where((ListChangeRecord c) => c.indexChanged(index))); |
| 28 |
| 29 List<PropertyChangeRecord> getPropertyChangeRecords( |
| 30 List<ChangeRecord> changes, Symbol property) => |
| 31 new List.from(changes.where( |
| 32 (ChangeRecord c) => c is PropertyChangeRecord && c.name == property)); |
OLD | NEW |