| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 | 9 |
| 10 import 'package:observe/observe.dart'; | 10 import 'package:observe/observe.dart'; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 }); | 77 }); |
| 78 | 78 |
| 79 test('should preserve the cursor position', () { | 79 test('should preserve the cursor position', () { |
| 80 var model = new NotifyModel('abcde'); | 80 var model = new NotifyModel('abcde'); |
| 81 var template = templateBind(new Element.html( | 81 var template = templateBind(new Element.html( |
| 82 '<template><input id="i1" value={{x}}></template>')); | 82 '<template><input id="i1" value={{x}}></template>')); |
| 83 testDiv.append(template.createInstance(model, new PolymerExpressions())); | 83 testDiv.append(template.createInstance(model, new PolymerExpressions())); |
| 84 | 84 |
| 85 return new Future(() { | 85 return new Future(() { |
| 86 var el = testDiv.query("#i1"); | 86 var el = testDiv.query("#i1"); |
| 87 var subscription = el.onInput.listen(expectAsync1((_) {}, count: 1)); | 87 var subscription = el.onInput.listen(expectAsync((_) {}, count: 1)); |
| 88 el.focus(); | 88 el.focus(); |
| 89 | 89 |
| 90 expect(el.value, 'abcde'); | 90 expect(el.value, 'abcde'); |
| 91 expect(model.x, 'abcde'); | 91 expect(model.x, 'abcde'); |
| 92 | 92 |
| 93 el.selectionStart = 3; | 93 el.selectionStart = 3; |
| 94 el.selectionEnd = 3; | 94 el.selectionEnd = 3; |
| 95 expect(el.selectionStart, 3); | 95 expect(el.selectionStart, 3); |
| 96 expect(el.selectionEnd, 3); | 96 expect(el.selectionEnd, 3); |
| 97 | 97 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 @reflectable | 146 @reflectable |
| 147 class NotifyModel extends ChangeNotifier { | 147 class NotifyModel extends ChangeNotifier { |
| 148 var _x; | 148 var _x; |
| 149 NotifyModel([this._x]); | 149 NotifyModel([this._x]); |
| 150 | 150 |
| 151 get x => _x; | 151 get x => _x; |
| 152 set x(value) { | 152 set x(value) { |
| 153 _x = notifyPropertyChange(#x, _x, value); | 153 _x = notifyPropertyChange(#x, _x, value); |
| 154 } | 154 } |
| 155 } | 155 } |
| OLD | NEW |