2 <script src=
"../../resources/js-test.js"></script>
3 <p>Please tun this test with DRT.
</p>
4 <p>To run it manually, double click on 'bar' and hit delete. You should see 'foo baz'.
</p>
5 <div id=
"includeSpace" contenteditable=
"true">foo b
<span id=
"target">a
</span>r baz
</div>
6 <div id=
"notIncludeSpace" contenteditable=
"true">foo b
<span id=
"target">a
</span>r baz
</div>
8 description('Test for smart delete forward on double click selected word.');
10 function testIt(sampleId
, expectedString
, expectedOffset
) {
11 if (!window
.testRunner
)
13 sample
= document
.getElementById(sampleId
);
14 var target
= sample
.querySelector('#target');
15 internals
.settings
.setSelectTrailingWhitespaceEnabled(sampleId
== 'includeSpace');
16 eventSender
.mouseMoveTo(target
.offsetLeft
, target
.offsetTop
);
17 eventSender
.mouseDown();
18 eventSender
.mouseUp();
19 eventSender
.mouseDown();
20 eventSender
.mouseUp();
22 testRunner
.execCommand('DeleteForward');
23 shouldBeEqualToString('sample.innerText', expectedString
);
24 shouldBe('getSelection().rangeCount', '1');
25 shouldBe('getSelection().focusNode', 'sample.firstChild');
26 shouldBe('getSelection().focusOffset', expectedOffset
.toString());
28 testIt('includeSpace', 'foo baz', 4);
29 testIt('notIncludeSpace', 'foo\u00A0baz', 3);