| 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:html'; | 5 import 'dart:html'; |
| 6 | 6 |
| 7 import 'package:observe/observe.dart'; | 7 import 'package:observe/observe.dart'; |
| 8 import 'package:observe/src/microtask.dart'; | 8 import 'package:observe/src/microtask.dart'; |
| 9 import 'package:polymer_expressions/polymer_expressions.dart'; | 9 import 'package:polymer_expressions/polymer_expressions.dart'; |
| 10 import 'package:template_binding/template_binding.dart'; | 10 import 'package:template_binding/template_binding.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 performMicrotaskCheckpoint(); | 43 performMicrotaskCheckpoint(); |
| 44 | 44 |
| 45 expect(testDiv.queryAll('div').map((n) => n.text), [ | 45 expect(testDiv.queryAll('div').map((n) => n.text), [ |
| 46 'Item 0 is hello', | 46 'Item 0 is hello', |
| 47 'Item 1 is from', | 47 'Item 1 is from', |
| 48 'Item 2 is polymer', | 48 'Item 2 is polymer', |
| 49 'Item 3 is expressions', | 49 'Item 3 is expressions', |
| 50 ]); | 50 ]); |
| 51 })); | 51 })); |
| 52 |
| 53 test('should update after changes', wrapMicrotask(() { |
| 54 var model = toObservable( |
| 55 ['hello', 'from', 'polymer', 'expressions', 'a', 'b', 'c']); |
| 56 |
| 57 templateBind(testDiv.query('template')) |
| 58 ..bindingDelegate = new PolymerExpressions() |
| 59 ..model = model; |
| 60 |
| 61 performMicrotaskCheckpoint(); |
| 62 |
| 63 expect(testDiv.queryAll('div').map((n) => n.text), [ |
| 64 'Item 0 is hello', |
| 65 'Item 1 is from', |
| 66 'Item 2 is polymer', |
| 67 'Item 3 is expressions', |
| 68 'Item 4 is a', |
| 69 'Item 5 is b', |
| 70 'Item 6 is c', |
| 71 ]); |
| 72 |
| 73 model.removeAt(1); |
| 74 model[1] = 'world'; |
| 75 model[2] = '!'; |
| 76 model.insert(5, 'e'); |
| 77 |
| 78 performMicrotaskCheckpoint(); |
| 79 |
| 80 expect(testDiv.queryAll('div').map((n) => n.text), [ |
| 81 'Item 0 is hello', |
| 82 'Item 1 is world', |
| 83 'Item 2 is !', |
| 84 'Item 3 is a', |
| 85 'Item 4 is b', |
| 86 'Item 5 is e', |
| 87 'Item 6 is c', |
| 88 ]); |
| 89 })); |
| 52 }); | 90 }); |
| 53 } | 91 } |
| OLD | NEW |