Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.textSelection.test.js |
— | — | @@ -241,9 +241,17 @@ |
242 | 242 | }); |
243 | 243 | } |
244 | 244 | |
| 245 | + var among = function(actual, expected, message) { |
| 246 | + if ($.isArray(expected)) { |
| 247 | + ok($.inArray(actual, expected) !== -1 , message + ' (got ' + actual + '; expected one of ' + expected.join(', ') + ')'); |
| 248 | + } else { |
| 249 | + equal(actual, expected, message); |
| 250 | + } |
| 251 | + }; |
| 252 | + |
245 | 253 | var pos = $textarea.textSelection('getCaretPosition', {startAndEnd: true}); |
246 | | - equal(pos[0], options.start, 'Caret start should be where we set it.'); |
247 | | - equal(pos[1], options.end, 'Caret end should be where we set it.'); |
| 254 | + among(pos[0], options.start, 'Caret start should be where we set it.'); |
| 255 | + among(pos[1], options.end, 'Caret end should be where we set it.'); |
248 | 256 | }); |
249 | 257 | } |
250 | 258 | |
— | — | @@ -252,8 +260,8 @@ |
253 | 261 | caretTest({ |
254 | 262 | description: 'getCaretPosition with original/empty selection - bug 31847 with IE 6/7/8', |
255 | 263 | text: caretSample, |
256 | | - start: 0, |
257 | | - end: 0, |
| 264 | + start: [0, caretSample.length], // Opera and Firefox (prior to FF 6.0) default caret to the end of the box (caretSample.length) |
| 265 | + end: [0, caretSample.length], // Other browsers default it to the beginning (0), so check both. |
258 | 266 | mode: 'get' |
259 | 267 | }); |
260 | 268 | |