4 <p>This tests WebKit preserves non-directional selection after unapplying replacement on Mac. To manually test on Mac,
</p>
6 <li>Select
"world" by double-clicking the word
</li>
7 <li>Replace
"world" by a character by pressing a key
</li>
9 <li>Extend selection to the left
</li>
11 <p>" world" should be selected.
</p>
12 <div contenteditable
>hello wo
<span id=
"target">r
</span>ld WebKit
</div>
15 if (window
.testRunner
&& window
.internals
) {
16 testRunner
.dumpAsText();
18 if (!window
.eventSender
)
19 document
.writeln('FAIL - this test requires eventSender');
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
+ '"');