4 <title>InsertText behavior after paragraph selection
</title>
5 <script src=
"../../resources/js-test.js"></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
);
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 () {
34 window
.finishJSTest();
36 manualInstruction
.appendChild(finishButton
);
37 document
.body
.appendChild(manualInstruction
);
40 window
.getSelection().collapse(container
.firstChild
.firstChild
, 0); // First <span>.
42 window
.testRunner
.execCommand('SelectParagraph');
43 document
.execCommand('InsertText', false, 'a');
47 document
.body
.removeChild(container
);