Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/assert_selection.html

Issue 2963113002: Introduce Selection#compute{Left,Top} in assert_selection() (Closed)
Patch Set: 2017-06-30T17:20:04 Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/assert_selection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = selection.document.getElementById('start');
358 const end = selection.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>',
368 '<div id="second">four |<span id="end"></span>five six</div>',
369 ].join(''));
370 }, 'computeLeft() and computeTop()');
348 </script> 371 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/assert_selection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698