| 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 |
| 10 // enabled. The tests reflect on LinkedHashMap.length and String.length. |
| 11 import 'dart:mirrors'; |
| 12 |
| 9 import 'package:polymer_expressions/eval.dart'; | 13 import 'package:polymer_expressions/eval.dart'; |
| 10 import 'package:polymer_expressions/filter.dart'; | 14 import 'package:polymer_expressions/filter.dart'; |
| 11 import 'package:polymer_expressions/parser.dart'; | 15 import 'package:polymer_expressions/parser.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 13 import 'package:observe/observe.dart'; | 17 import 'package:observe/observe.dart'; |
| 14 | 18 |
| 15 main() { | 19 main() { |
| 16 | 20 |
| 17 group('eval', () { | 21 group('eval', () { |
| 18 test('should return the model for an empty expression', () { | 22 test('should return the model for an empty expression', () { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 items.add(foo); | 322 items.add(foo); |
| 319 }, | 323 }, |
| 320 afterMatcher: (c) => c.iterable.contains(foo) | 324 afterMatcher: (c) => c.iterable.contains(foo) |
| 321 ); | 325 ); |
| 322 }); | 326 }); |
| 323 | 327 |
| 324 }); | 328 }); |
| 325 | 329 |
| 326 } | 330 } |
| 327 | 331 |
| 328 class Foo extends Object with ChangeNotifierMixin { | 332 @reflectable |
| 333 class Foo extends ChangeNotifierBase { |
| 329 String _name; | 334 String _name; |
| 330 String get name => _name; | 335 String get name => _name; |
| 331 void set name(String n) { | 336 void set name(String n) { |
| 332 _name = notifyPropertyChange(#name, _name, n); | 337 _name = notifyPropertyChange(#name, _name, n); |
| 333 } | 338 } |
| 334 | 339 |
| 335 int age; | 340 int age; |
| 336 Foo child; | 341 Foo child; |
| 337 List<int> items; | 342 List<int> items; |
| 338 | 343 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 mutate(); | 393 mutate(); |
| 389 // 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 |
| 390 return Future.wait([future, new Future(() { | 395 return Future.wait([future, new Future(() { |
| 391 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"); |
| 392 })]); | 397 })]); |
| 393 } | 398 } |
| 394 | 399 |
| 395 // 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 |
| 396 class WordElement extends ObservableBase { | 401 class WordElement extends ObservableBase { |
| 397 @observable List chars1 = 'abcdefg'.split(''); | 402 @observable List chars1 = 'abcdefg'.split(''); |
| 398 List filteredList(List original) => [original[0], original[1]]; | 403 @reflectable List filteredList(List original) => [original[0], original[1]]; |
| 399 } | 404 } |
| OLD | NEW |