Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / doubleclick-with-split-text.html
blobd928173dde0cbd8f4722899872b080e2d427fe1e
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <div id="container">
4 For manual testing,
5 <ol>
6 <li>Double click at "hello" or "world".</li>
7 <li>You see selection where you double clicked.</li>
8 </ol>
9 <div id="sample" contenteditable>hello world</div>
10 </div>
11 <script>
12 description('Double click to select word should work with DOM modification by click event handler.');
13 var sample = document.getElementById('sample');
14 var selection = getSelection();
15 sample.addEventListener('click', function() {
16 if (!selection.rangeCount)
17 return;
18 selection.getRangeAt(0).insertNode(document.createElement('span'));
19 });
20 if (window.eventSender) {
21 eventSender.mouseMoveTo(sample.offsetLeft + 10, sample.offsetTop + 1);
22 eventSender.mouseDown();
23 eventSender.mouseUp();
24 eventSender.mouseDown();
25 eventSender.mouseUp();
26 // To make this platform independent, we use |trim()| for checking selected
27 // word, e.g. Windows selects word with a trailing space, but Mac selects
28 // only word.
29 shouldBeEqualToString('selection.toString().trim()', 'hello');
30 document.getElementById('container').outerHTML = '';
32 </script>