Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / insert-text-not-inheriting-block-properties.html
blob58d0b3c45ab811e0b93b3fe21bf26ce2f579912c
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>InsertText behavior after paragraph selection</title>
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <script>
9 description('If you select a paragraph and type a character, block style properties should not be inherited to the next paragraph.');
11 var container = document.createElement('div');
12 container.contentEditable = true;
13 container.style.margin = '1em';
14 container.style.padding = '1em';
15 container.style.border = '4px gray solid';
16 container.innerHTML = '<p><span>Foo</span></p><p style="text-indent: 3em;"><span>Bar</span></p>';
17 // This block must be placed at the beginning of the document, otherwise the bug does not reproduce.
18 document.body.insertBefore(container, document.body.firstChild);
20 function check()
22 shouldBeEqualToString('container.innerHTML', '<p style="text-indent: 3em;"><span>aBar</span></p>');
25 if (!window.testRunner) {
26 window.jsTestIsAsync = true;
27 var manualInstruction = document.createElement('p');
28 manualInstruction.innerHTML = '<strong>This test can\'t be run automatically without testRunner. To run this test manually, triple-click the paragraph containing "Foo", type "a", then press the "Finish" button: </strong>';
29 var finishButton = document.createElement('input');
30 finishButton.type = 'button';
31 finishButton.value = 'Finish';
32 finishButton.addEventListener('click', function () {
33 check();
34 window.finishJSTest();
35 });
36 manualInstruction.appendChild(finishButton);
37 document.body.appendChild(manualInstruction);
38 } else {
39 container.focus();
40 window.getSelection().collapse(container.firstChild.firstChild, 0); // First <span>.
42 window.testRunner.execCommand('SelectParagraph');
43 document.execCommand('InsertText', false, 'a');
45 check();
47 document.body.removeChild(container);
49 </script>
50 </body>
51 </html>