OLD | NEW |
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:logging/logging.dart'; | 6 import 'package:logging/logging.dart'; |
7 import 'package:observe/observe.dart'; | 7 import 'package:observe/observe.dart'; |
8 import 'package:observe/src/dirty_check.dart' as dirty_check; | 8 import 'package:observe/src/dirty_check.dart' as dirty_check; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'observe_test_utils.dart'; | 10 import 'observe_test_utils.dart'; |
11 | 11 |
12 // Note: this ensures we run the dartanalyzer on the @observe package. | |
13 // @static-clean | |
14 | |
15 void main() { | 12 void main() { |
16 // Note: to test the basic Observable system, we use ObservableBox due to its | 13 // Note: to test the basic Observable system, we use ObservableBox due to its |
17 // simplicity. We also test a variant that is based on dirty-checking. | 14 // simplicity. We also test a variant that is based on dirty-checking. |
18 | 15 |
19 observeTest('no observers at the start', () { | 16 observeTest('no observers at the start', () { |
20 expect(dirty_check.allObservablesCount, 0); | 17 expect(dirty_check.allObservablesCount, 0); |
21 }); | 18 }); |
22 | 19 |
23 group('WatcherModel', () => _observeTests((x) => new WatcherModel(x))); | 20 group('WatcherModel', () => _observeTests((x) => new WatcherModel(x))); |
24 | 21 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 @observable T value; | 256 @observable T value; |
260 | 257 |
261 WatcherModel([T initialValue]) : value = initialValue; | 258 WatcherModel([T initialValue]) : value = initialValue; |
262 | 259 |
263 String toString() => '#<$runtimeType value: $value>'; | 260 String toString() => '#<$runtimeType value: $value>'; |
264 } | 261 } |
265 | 262 |
266 class ModelSubclass<T> extends WatcherModel<T> { | 263 class ModelSubclass<T> extends WatcherModel<T> { |
267 ModelSubclass([T initialValue]) : super(initialValue); | 264 ModelSubclass([T initialValue]) : super(initialValue); |
268 } | 265 } |
OLD | NEW |