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 library eval_test; | 5 library eval_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 // NOTE: this import is unused, but we use it to cause all mirrors to be | 9 // NOTE: this import is unused, but we use it to cause all mirrors to be |
10 // enabled. The tests reflect on LinkedHashMap.length and String.length. | 10 // enabled. The tests reflect on LinkedHashMap.length and String.length. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 }, | 323 }, |
324 afterMatcher: (c) => c.iterable.contains(foo) | 324 afterMatcher: (c) => c.iterable.contains(foo) |
325 ); | 325 ); |
326 }); | 326 }); |
327 | 327 |
328 }); | 328 }); |
329 | 329 |
330 } | 330 } |
331 | 331 |
332 @reflectable | 332 @reflectable |
333 class Foo extends ChangeNotifierBase { | 333 class Foo extends ChangeNotifier { |
334 String _name; | 334 String _name; |
335 String get name => _name; | 335 String get name => _name; |
336 void set name(String n) { | 336 void set name(String n) { |
337 _name = notifyPropertyChange(#name, _name, n); | 337 _name = notifyPropertyChange(#name, _name, n); |
338 } | 338 } |
339 | 339 |
340 int age; | 340 int age; |
341 Foo child; | 341 Foo child; |
342 List<int> items; | 342 List<int> items; |
343 | 343 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 passed = true; | 391 passed = true; |
392 }); | 392 }); |
393 mutate(); | 393 mutate(); |
394 // fail if we don't receive an update by the next event loop | 394 // fail if we don't receive an update by the next event loop |
395 return Future.wait([future, new Future(() { | 395 return Future.wait([future, new Future(() { |
396 expect(passed, true, reason: "Didn't receive a change notification on $s"); | 396 expect(passed, true, reason: "Didn't receive a change notification on $s"); |
397 })]); | 397 })]); |
398 } | 398 } |
399 | 399 |
400 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 | 400 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 |
401 class WordElement extends ObservableBase { | 401 class WordElement extends Observable { |
402 @observable List chars1 = 'abcdefg'.split(''); | 402 @observable List chars1 = 'abcdefg'.split(''); |
403 @reflectable List filteredList(List original) => [original[0], original[1]]; | 403 @reflectable List filteredList(List original) => [original[0], original[1]]; |
404 } | 404 } |
OLD | NEW |