| Index: pkg/polymer_expressions/test/eval_test.dart
|
| diff --git a/pkg/polymer_expressions/test/eval_test.dart b/pkg/polymer_expressions/test/eval_test.dart
|
| index 2181215eb887734966d55aa0c17e4ef764e5d916..8ca3490946315ca92037400ec828c3479a49722a 100644
|
| --- a/pkg/polymer_expressions/test/eval_test.dart
|
| +++ b/pkg/polymer_expressions/test/eval_test.dart
|
| @@ -218,22 +218,33 @@ main() {
|
|
|
| test('should evaluate an "in" expression', () {
|
| var scope = new Scope(variables: {'items': [1, 2, 3]});
|
| - var comprehension = eval(parse('item in items'), scope);
|
| - expect(comprehension.iterable, orderedEquals([1, 2, 3]));
|
| + var childScopes = eval(parse('item in items'), scope);
|
| + expect(childScopes.length, 3);
|
| + expect(childScopes[0].varName, 'item');
|
| + expect(childScopes[0].value, 1);
|
| + expect(childScopes[1].varName, 'item');
|
| + expect(childScopes[1].value, 2);
|
| + expect(childScopes[2].varName, 'item');
|
| + expect(childScopes[2].value, 3);
|
| });
|
|
|
| test('should evaluate complex "in" expressions', () {
|
| var holder = new ListHolder([1, 2, 3]);
|
| var scope = new Scope(variables: {'holder': holder});
|
| - var comprehension = eval(parse('item in holder.items'), scope);
|
| - expect(comprehension.iterable, orderedEquals([1, 2, 3]));
|
| + var childScopes = eval(parse('item in holder.items'), scope);
|
| + expect(childScopes.length, 3);
|
| + expect(childScopes[0].varName, 'item');
|
| + expect(childScopes[0].value, 1);
|
| + expect(childScopes[1].varName, 'item');
|
| + expect(childScopes[1].value, 2);
|
| + expect(childScopes[2].varName, 'item');
|
| + expect(childScopes[2].value, 3);
|
| });
|
|
|
| test('should handle null iterators in "in" expressions', () {
|
| var scope = new Scope(variables: {'items': null});
|
| - var comprehension = eval(parse('item in items'), scope);
|
| - expect(comprehension, isNotNull);
|
| - expect(comprehension.iterable, []);
|
| + var childScopes = eval(parse('item in items'), scope);
|
| + expect(childScopes.length, 0);
|
| });
|
|
|
| });
|
| @@ -345,11 +356,12 @@ main() {
|
| var foo = new Foo(name: 'foo');
|
| return expectObserve('item in items',
|
| variables: {'items': items},
|
| - beforeMatcher: (c) => c.iterable.isEmpty,
|
| + beforeMatcher: (c) => c.isEmpty,
|
| mutate: () {
|
| items.add(foo);
|
| },
|
| - afterMatcher: (c) => c.iterable.contains(foo)
|
| + afterMatcher:
|
| + (c) => c.single.varName == 'item' && c.single.value == foo
|
| );
|
| });
|
|
|
|
|