Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / undo / undo-combined-delete-boundary.html
blobdb18303a3e7021e6bd17a0b38fe44ecf1fd43e13
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div id="container">
5 <p id="description"></p>
6 <p>To test manually, place the cursor after 'o' in 'word' and delete it character by character. Do ctrl+z. On Mac, 'word' should be selected. On other platforms 'word' should not be selected and the cursor should be placed after 'o' in 'word'.</p>
7 <div id="test" style="border: 2px solid red;" contenteditable>This wo<b>rd </b>should be selected only on mac.</div>
8 </div>
9 <div id="console"></div>
10 <script src="../../resources/js-test.js"></script>
11 <script>
12 description('Verifies the selection behavior on undoing a text deletion.');
13 var sampleHTML = 'This wo<b>rd </b>should be selected only on mac.';
14 var selectionNode = document.getElementById('test').firstChild; // Text node 'This wo'
15 var selectionOffset = selectionNode.length;
16 var endNodeMac = document.getElementById('test').childNodes[1].firstChild; // Text node 'rd '
17 var endOffsetMac = endNodeMac.length - 1;
18 var startOffsetMac = selectionNode.data.indexOf(' ')+1;
19 var selection = window.getSelection();
21 function $(id) { return document.getElementById(id); }
23 function undoTest(platform, expectedStartNode, expectedStartOffset, expectedEndNode, expectedEndOffset, selectedText) {
24 debug(platform);
25 internals.settings.setEditingBehavior(platform);
27 selection.collapse(selectionNode, selectionOffset);
28 for (var i = 0; i < 2; i++)
29 document.execCommand('delete');
30 for (var i = 0; i < 2; i++)
31 document.execCommand('forwarddelete');
32 document.execCommand('undo');
34 shouldBeEqualToString('selection.anchorNode.data', expectedStartNode.data);
35 shouldBe('selection.anchorOffset', expectedStartOffset + '');
36 shouldBeEqualToString('selection.focusNode.data', expectedEndNode.data);
37 shouldBe('selection.focusOffset', expectedEndOffset + '');
38 shouldBeEqualToString('selection.toString()', selectedText);
39 shouldBeEqualToString('$("test").innerHTML', sampleHTML);
42 if (window.internals) {
43 undoTest('mac', selectionNode, startOffsetMac, endNodeMac, endOffsetMac, 'word');
44 undoTest('win', selectionNode, selectionOffset, selectionNode, selectionOffset, '');
45 undoTest('unix', selectionNode, selectionOffset, selectionNode, selectionOffset, '');
46 undoTest('android', selectionNode, selectionOffset, selectionNode, selectionOffset, '');
48 if (window.testRunner)
49 document.getElementById('container').outerHTML = '';
50 </script>
51 </body>
52 </html>