Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / 5195166-1.html
blobbd1a4075080cdb5e97d05c96d1c517ad0c5607ad
1 <p>This tests for a bug where extending a selection created with the mouse would blow it away before extending it.</p>
2 <div id="div" contenteditable="true">There <span id="select" style="color:green">should be</span> six characters selected in this sentence on Mac and four characters selected on Win/Linux.</div>
3 <ul id="console"></ul>
4 <script>
5 function log(str)
7 console = document.getElementById("console");
8 li = document.createElement("li");
9 text = document.createTextNode(str);
10 console.appendChild(li);
11 li.appendChild(text);
14 function runTest(platform, expectedText)
16 internals.settings.setEditingBehavior(platform);
18 var target = document.getElementById('select');
19 var startX = target.offsetLeft + target.offsetWidth;
20 var y = target.offsetTop + target.offsetHeight / 2;
21 var endX = target.offsetLeft;
23 // Select all the green text using the mouse.
24 // Use a word-granularity selection to avoid eventSender bug.
25 // Using just a single-click would not act is if the initial
26 // mouseDown was at (endX, y), resulting in a collapsed selection.
27 eventSender.mouseMoveTo(startX, y);
28 eventSender.mouseDown();
29 eventSender.mouseUp();
30 eventSender.mouseDown();
31 eventSender.mouseMoveTo(endX, y);
32 eventSender.mouseUp();
33 // Extending this 5 character selection will select 6 characters on mac,
34 // but shrink the selection on win/linux.
35 testRunner.execCommand("MoveForwardAndModifySelection");
36 // Extending it in this way flips the anchor and the focus on Mac.
37 var selectedText = window.getSelection().toString();
38 if (selectedText != expectedText)
39 log("Failure: Selected text was \"" + selectedText + "\" and should be \"" + expectedText + "\"");
40 else
41 log("Success");
44 if (window.testRunner && window.internals) {
45 testRunner.dumpAsText()
46 runTest('mac', 'should be s');
47 runTest('win', 'hould be ');
48 } else {
49 log("Failure: To test manually, select the green text " +
50 "starting at the end via double-click (i.e. word granularity), then shift+right-arrow. " +
51 "On Win/Linux you should see 'hould be ' selected. On Mac, you should see 'should be s' selected." +
52 "There's currently a bug that selects the space " +
53 "after 'should be' during the initial selection (https://bugs.webkit.org/show_bug.cgi?id=36256). " +
54 "Once that's fixed, it the final selected text should be 'should be ' on Mac and 'hould be' on Win/Linux.")
56 </script>