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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html
diff --git a/LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html b/LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html
new file mode 100644
index 0000000000000000000000000000000000000000..58d0b3c45ab811e0b93b3fe21bf26ce2f579912c
--- /dev/null
+++ b/LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>InsertText behavior after paragraph selection</title>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description('If you select a paragraph and type a character, block style properties should not be inherited to the next paragraph.');
+
+var container = document.createElement('div');
+container.contentEditable = true;
+container.style.margin = '1em';
+container.style.padding = '1em';
+container.style.border = '4px gray solid';
+container.innerHTML = '<p><span>Foo</span></p><p style="text-indent: 3em;"><span>Bar</span></p>';
+// This block must be placed at the beginning of the document, otherwise the bug does not reproduce.
+document.body.insertBefore(container, document.body.firstChild);
+
+function check()
+{
+ shouldBeEqualToString('container.innerHTML', '<p style="text-indent: 3em;"><span>aBar</span></p>');
+}
+
+if (!window.testRunner) {
+ window.jsTestIsAsync = true;
+ var manualInstruction = document.createElement('p');
+ 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>';
+ var finishButton = document.createElement('input');
+ finishButton.type = 'button';
+ finishButton.value = 'Finish';
+ finishButton.addEventListener('click', function () {
+ check();
+ window.finishJSTest();
+ });
+ manualInstruction.appendChild(finishButton);
+ document.body.appendChild(manualInstruction);
+} else {
+ container.focus();
+ window.getSelection().collapse(container.firstChild.firstChild, 0); // First <span>.
+
+ window.testRunner.execCommand('SelectParagraph');
+ document.execCommand('InsertText', false, 'a');
+
+ check();
+
+ document.body.removeChild(container);
+}
+</script>
+</body>
+</html>
« 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