Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / directionality-after-undo-replace.html
blobf08c79542e7b30faa5f53c28c23806e6babb9bf1
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This tests WebKit preserves non-directional selection after unapplying replacement on Mac. To manually test on Mac,</p>
5 <ol>
6 <li>Select "world" by double-clicking the word</li>
7 <li>Replace "world" by a character by pressing a key</li>
8 <li>Undo</li>
9 <li>Extend selection to the left</li>
10 </ol>
11 <p>" world" should be selected.</p>
12 <div contenteditable>hello wo<span id="target">r</span>ld WebKit</div>
13 <script>
15 if (window.testRunner && window.internals) {
16 testRunner.dumpAsText();
18 if (!window.eventSender)
19 document.writeln('FAIL - this test requires eventSender');
20 else {
21 internals.settings.setEditingBehavior('mac');
23 var test = document.getElementById('target');
24 eventSender.mouseMoveTo(target.offsetLeft + target.offsetWidth / 2, target.offsetTop + target.offsetHeight / 2);
25 eventSender.mouseDown();
26 eventSender.mouseUp();
28 eventSender.leapForward(200);
30 eventSender.mouseDown();
31 eventSender.mouseUp();
33 document.execCommand('InsertText', false, 'a');
34 document.execCommand('Undo');
35 window.getSelection().modify('extend', 'left', 'character');
37 var actual = window.getSelection().toString();
38 // Windows has a trailing whitespace, other platforms don't.
39 document.writeln((actual == ' world' || actual == ' world ') ? 'PASS' : 'FAIL - expected " world" but got "' + actual + '"');
43 </script>
44 </body>
45 </html>