| 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 import 'package:polymer_expressions/eval.dart'; | 9 import 'package:polymer_expressions/eval.dart'; |
| 10 import 'package:polymer_expressions/filter.dart'; | 10 import 'package:polymer_expressions/filter.dart'; |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 matcher, | 364 matcher, |
| 365 reason: s); | 365 reason: s); |
| 366 | 366 |
| 367 expectObserve(String s, { | 367 expectObserve(String s, { |
| 368 Object model, | 368 Object model, |
| 369 Map variables: const {}, | 369 Map variables: const {}, |
| 370 dynamic beforeMatcher, | 370 dynamic beforeMatcher, |
| 371 mutate(), | 371 mutate(), |
| 372 dynamic afterMatcher}) { | 372 dynamic afterMatcher}) { |
| 373 | 373 |
| 374 var observer = observe(new Parser(s).parse(), | 374 var scope = new Scope(model: model, variables: variables); |
| 375 new Scope(model: model, variables: variables)); | 375 var observer = observe(new Parser(s).parse(), scope); |
| 376 update(observer, scope); |
| 376 expect(observer.currentValue, beforeMatcher); | 377 expect(observer.currentValue, beforeMatcher); |
| 377 var passed = false; | 378 var passed = false; |
| 378 var future = observer.onUpdate.first.then((value) { | 379 var future = observer.onUpdate.first.then((value) { |
| 379 expect(value, afterMatcher); | 380 expect(value, afterMatcher); |
| 380 expect(observer.currentValue, afterMatcher); | 381 expect(observer.currentValue, afterMatcher); |
| 381 passed = true; | 382 passed = true; |
| 382 }); | 383 }); |
| 383 mutate(); | 384 mutate(); |
| 384 // fail if we don't receive an update by the next event loop | 385 // fail if we don't receive an update by the next event loop |
| 385 return Future.wait([future, new Future(() { | 386 return Future.wait([future, new Future(() { |
| 386 expect(passed, true, reason: "Didn't receive a change notification on $s"); | 387 expect(passed, true, reason: "Didn't receive a change notification on $s"); |
| 387 })]); | 388 })]); |
| 388 } | 389 } |
| OLD | NEW |