Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / deleting / smart-delete-004.html
blob7ebfcb9e4df295b3894fc3690088477d0150f3d1
1 <!DOCTYPE html>
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>
7 <script>
8 description('Test for smart delete forward on double click selected word.');
9 var sample;
10 function testIt(sampleId, expectedString, expectedOffset) {
11 if (!window.testRunner)
12 return;
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();
21 debug(sampleId);
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);
30 </script>