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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 map.remove('b'); | 150 map.remove('b'); |
151 map['c'] = 3; | 151 map['c'] = 3; |
152 }).then(_nextMicrotask).then((_) { | 152 }).then(_nextMicrotask).then((_) { |
153 expect(testDiv.text, 'a:1,c:3,'); | 153 expect(testDiv.text, 'a:1,c:3,'); |
154 map['a'] = 4; | 154 map['a'] = 4; |
155 }).then(_nextMicrotask).then((_) { | 155 }).then(_nextMicrotask).then((_) { |
156 expect(testDiv.text, 'a:4,c:3,'); | 156 expect(testDiv.text, 'a:4,c:3,'); |
157 }); | 157 }); |
158 }); | 158 }); |
159 | 159 |
160 // TODO(sigmund): enable this test (issue 19105) | |
161 // _cursorPositionTest(false); | |
162 _cursorPositionTest(true); | |
163 | |
164 // Regression tests for issue 18792. | 160 // Regression tests for issue 18792. |
165 for (var usePolymer in [true, false]) { | 161 for (var usePolymer in [true, false]) { |
166 // We run these tests both with PolymerExpressions and with the default | 162 // We run these tests both with PolymerExpressions and with the default |
167 // delegate to ensure the results are consistent. The expressions on these | 163 // delegate to ensure the results are consistent. The expressions on these |
168 // tests use syntax common to both delegates. | 164 // tests use syntax common to both delegates. |
169 var name = usePolymer ? 'polymer-expressions' : 'default'; | 165 var name = usePolymer ? 'polymer-expressions' : 'default'; |
170 group('$name delegate', () { | 166 group('$name delegate', () { |
171 // Use <option template repeat="{{y}}" value="{{}}">item {{}} | 167 // Use <option template repeat="{{y}}" value="{{}}">item {{}} |
172 _initialSelectTest('{{y}}', '{{}}', usePolymer); | 168 _initialSelectTest('{{y}}', '{{}}', usePolymer); |
173 _updateSelectTest('{{y}}', '{{}}', usePolymer); | 169 _updateSelectTest('{{y}}', '{{}}', usePolymer); |
| 170 |
| 171 // TODO(jmesserly): this is broken with polymer-expressions, see |
| 172 // http://dartbug.com/19105 |
| 173 if (!usePolymer) _cursorPositionTest(usePolymer); |
174 }); | 174 }); |
175 } | 175 } |
176 | 176 |
177 group('polymer-expressions delegate, polymer syntax', () { | 177 group('polymer-expressions delegate, polymer syntax', () { |
178 // Use <option template repeat="{{i in y}}" value="{{i}}">item {{i}} | 178 // Use <option template repeat="{{i in y}}" value="{{i}}">item {{i}} |
179 _initialSelectTest('{{i in y}}', '{{i}}', true); | 179 _initialSelectTest('{{i in y}}', '{{i}}', true); |
180 _updateSelectTest('{{i in y}}', '{{i}}', true); | 180 _updateSelectTest('{{i in y}}', '{{i}}', true); |
181 }); | 181 }); |
182 }); | 182 }); |
183 }); | 183 }); |
(...skipping 19 matching lines...) Expand all Loading... |
203 | 203 |
204 expect(el.value, 'abcde'); | 204 expect(el.value, 'abcde'); |
205 expect(model.x, 'abcde'); | 205 expect(model.x, 'abcde'); |
206 | 206 |
207 el.selectionStart = 3; | 207 el.selectionStart = 3; |
208 el.selectionEnd = 3; | 208 el.selectionEnd = 3; |
209 expect(el.selectionStart, 3); | 209 expect(el.selectionStart, 3); |
210 expect(el.selectionEnd, 3); | 210 expect(el.selectionEnd, 3); |
211 | 211 |
212 el.value = 'abc de'; | 212 el.value = 'abc de'; |
213 // Updating the input value programatically (even to the same value in | 213 // Updating the input value programmatically (even to the same value in |
214 // Chrome) loses the selection position. | 214 // Chrome) loses the selection position. |
215 expect(el.selectionStart, 6); | 215 expect(el.selectionStart, 6); |
216 expect(el.selectionEnd, 6); | 216 expect(el.selectionEnd, 6); |
217 | 217 |
218 el.selectionStart = 4; | 218 el.selectionStart = 4; |
219 el.selectionEnd = 4; | 219 el.selectionEnd = 4; |
220 | 220 |
221 expect(model.x, 'abcde'); | 221 expect(model.x, 'abcde'); |
222 el.dispatchEvent(new Event('input')); | 222 el.dispatchEvent(new Event('input')); |
223 expect(model.x, 'abc de'); | 223 expect(model.x, 'abc de'); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 get y => _y; | 311 get y => _y; |
312 set y(value) { | 312 set y(value) { |
313 _y = notifyPropertyChange(#y, _y, value); | 313 _y = notifyPropertyChange(#y, _y, value); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 class _NullTreeSanitizer implements NodeTreeSanitizer { | 317 class _NullTreeSanitizer implements NodeTreeSanitizer { |
318 void sanitizeTree(Node node) {} | 318 void sanitizeTree(Node node) {} |
319 } | 319 } |
320 final _nullTreeSanitizer = new _NullTreeSanitizer(); | 320 final _nullTreeSanitizer = new _NullTreeSanitizer(); |
OLD | NEW |