| 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 bindings_test; | 5 library bindings_test; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
| 10 import 'package:observe/observe.dart'; | 10 import 'package:observe/observe.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 testDiv.remove(); | 30 testDiv.remove(); |
| 31 testDiv = null; | 31 testDiv = null; |
| 32 stop.cancel(); | 32 stop.cancel(); |
| 33 stop = null; | 33 stop = null; |
| 34 messages = []; | 34 messages = []; |
| 35 }); | 35 }); |
| 36 | 36 |
| 37 observeTest('should update binding when data changes', () { | 37 observeTest('should update binding when data changes', () { |
| 38 var model = new NotifyModel(); | 38 var model = new NotifyModel(); |
| 39 var binding = new PolymerExpressions() | 39 var binding = new PolymerExpressions() |
| 40 .getBinding(model, 'x', null, null); | 40 .prepareBinding('x', null, null)(model, null); |
| 41 expect(binding.value, isNull); | 41 expect(binding.value, isNull); |
| 42 model.x = "hi"; | 42 model.x = "hi"; |
| 43 performMicrotaskCheckpoint(); | 43 performMicrotaskCheckpoint(); |
| 44 expect(binding.value, 'hi'); | 44 expect(binding.value, 'hi'); |
| 45 expect(messages.length, 0); | 45 expect(messages.length, 0); |
| 46 }); | 46 }); |
| 47 | 47 |
| 48 observeTest('should update text content when data changes', () { | 48 observeTest('should update text content when data changes', () { |
| 49 var model = new NotifyModel('abcde'); | 49 var model = new NotifyModel('abcde'); |
| 50 var template = templateBind(new Element.html( | 50 var template = templateBind(new Element.html( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 var _x; | 123 var _x; |
| 124 NotifyModel([this._x]); | 124 NotifyModel([this._x]); |
| 125 | 125 |
| 126 get x => _x; | 126 get x => _x; |
| 127 set x(value) { | 127 set x(value) { |
| 128 _x = notifyPropertyChange(#x, _x, value); | 128 _x = notifyPropertyChange(#x, _x, value); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); | 132 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); |
| OLD | NEW |