OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="assert_selection.js"></script> | 4 <script src="assert_selection.js"></script> |
5 <script> | 5 <script> |
6 function checked_assert_selection(input, command, output) { | 6 function checked_assert_selection(input, command, output) { |
7 try { | 7 try { |
8 assert_selection(input, command, output); | 8 assert_selection(input, command, output); |
9 } catch (exception) { | 9 } catch (exception) { |
10 return exception.message; | 10 return exception.message; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 {removeSampleIfSucceeded: true}); | 306 {removeSampleIfSucceeded: true}); |
307 assert_equals(sample2.iframe_.parentNode, null, | 307 assert_equals(sample2.iframe_.parentNode, null, |
308 'removeSampleIfSucceeded: true'); | 308 'removeSampleIfSucceeded: true'); |
309 | 309 |
310 const sample3 = assert_selection('abc', '', 'abc'); | 310 const sample3 = assert_selection('abc', '', 'abc'); |
311 assert_equals(sample3.iframe_.parentNode, null, 'with default options'); | 311 assert_equals(sample3.iframe_.parentNode, null, 'with default options'); |
312 | 312 |
313 const sample4 = assert_selection('abc', '', 'abc', 'description'); | 313 const sample4 = assert_selection('abc', '', 'abc', 'description'); |
314 assert_equals(sample4.iframe_.parentNode, null, 'with description'); | 314 assert_equals(sample4.iframe_.parentNode, null, 'with description'); |
315 }, 'removeSampleIfSucceeded'); | 315 }, 'removeSampleIfSucceeded'); |
| 316 |
| 317 test(() => { |
| 318 assert_exists(window, 'internals'); |
| 319 assert_exists(window, 'eventSender'); |
| 320 assert_selection( |
| 321 'foo|bar', |
| 322 () => { assert_equals(internals.textAffinity, 'Downstream'); }, |
| 323 'foo|bar'); |
| 324 assert_selection( |
| 325 '<div contenteditable style="width: 25px;">foobar</div>', |
| 326 selection => { |
| 327 eventSender.dragMode = false; |
| 328 var document = selection.document; |
| 329 var div = document.querySelector('div'); |
| 330 eventSender.mouseMoveTo(document.offsetLeft + div.offsetLeft + 20, |
| 331 document.offsetTop + div.offsetTop + 5); |
| 332 eventSender.mouseDown(); |
| 333 eventSender.mouseUp(); |
| 334 assert_equals(internals.textAffinity, 'Upstream'); }, |
| 335 '<div contenteditable style="width: 25px;">foo|bar</div>'); |
| 336 }, 'Textaffinity'); |
316 </script> | 337 </script> |
OLD | NEW |