Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html

Issue 214313002: Don't inherit block style if text is inserted after paragraph selection. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use Selection.collapse(). Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 propert ies should not be inherited to the next paragraph.');
10
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);
19
20 function check()
21 {
22 shouldBeEqualToString('container.innerHTML', '<p style="text-indent: 3em;">< span>aBar</span></p>');
23 }
24
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 conta ining "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>.
41
42 window.testRunner.execCommand('SelectParagraph');
43 document.execCommand('InsertText', false, 'a');
44
45 check();
46
47 document.body.removeChild(container);
48 }
49 </script>
50 </body>
51 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698