Chromium Code Reviews| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 eventSender.dragMode = false; | 338 eventSender.dragMode = false; |
| 339 var document = selection.document; | 339 var document = selection.document; |
| 340 var div = document.querySelector('div'); | 340 var div = document.querySelector('div'); |
| 341 eventSender.mouseMoveTo(document.offsetLeft + div.offsetLeft + 20, | 341 eventSender.mouseMoveTo(document.offsetLeft + div.offsetLeft + 20, |
| 342 document.offsetTop + div.offsetTop + 5); | 342 document.offsetTop + div.offsetTop + 5); |
| 343 eventSender.mouseDown(); | 343 eventSender.mouseDown(); |
| 344 eventSender.mouseUp(); | 344 eventSender.mouseUp(); |
| 345 assert_equals(internals.textAffinity, 'Upstream'); }, | 345 assert_equals(internals.textAffinity, 'Upstream'); }, |
| 346 '<div contenteditable style="width: 25px;">foo|bar</div>'); | 346 '<div contenteditable style="width: 25px;">foo|bar</div>'); |
| 347 }, 'Textaffinity'); | 347 }, 'Textaffinity'); |
| 348 | |
| 349 test(() => { | |
| 350 assert_exists(window, 'eventSender'); | |
| 351 assert_selection( | |
| 352 [ | |
| 353 '<div id="first">one <span id="start"></span>two three</div>', | |
| 354 '<div id="second">four <span id="end"></span>five six</div>', | |
| 355 ].join(''), | |
| 356 selection => { | |
| 357 const start = document.getElementById('start'); | |
| 358 const end = document.getElementById('end'); | |
| 359 eventSender.mouseMoveTo(selection.computeLeft(start), | |
| 360 selection.computeTop(start)); | |
| 361 eventSender.mouseDown(); | |
| 362 eventSender.mouseMoveTo(selection.computeLeft(end), | |
| 363 selection.computeTop(end)); | |
| 364 eventSender.mouseUp(); | |
| 365 }, | |
| 366 [ | |
| 367 '<div id="first">one <span id="start"></span>two three</div>', | |
|
yoichio
2017/06/29 08:09:35
We miss cursors in expect.
yosin_UTC9
2017/06/29 09:06:19
Oops, I forgot to update.
| |
| 368 '<div id="second">four <span id="end"></span>five six</div>', | |
| 369 ].join('')); | |
| 370 }, 'computeLeft() and computeTop()'); | |
| 348 </script> | 371 </script> |
| OLD | NEW |