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

Unified Diff: LayoutTests/editing/style/background-color-retained.html

Issue 19477010: Background color applied on a selection of text is lost when the selection is deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
Index: LayoutTests/editing/style/background-color-retained.html
diff --git a/LayoutTests/editing/style/background-color-retained.html b/LayoutTests/editing/style/background-color-retained.html
new file mode 100644
index 0000000000000000000000000000000000000000..21fd002c687ee40da65dc16982b109784e29e690
--- /dev/null
+++ b/LayoutTests/editing/style/background-color-retained.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
+<script src=../../fast/js/resources/js-test-pre.js language="JavaScript" type="text/JavaScript" ></script>
+<script>
+function editingTest() {
+ var testDiv = document.getElementById("test");
+ testDiv.focus();
+ execSelectAllCommand();
+ document.execCommand("BackColor", false, "green");
yosin_UTC9 2013/09/09 04:57:48 Can we put <span style="background-color: green">.
+ execCutCommand();
yosin_UTC9 2013/09/09 04:57:48 "Cut" command works only in DRT. So, this test cas
yosin_UTC9 2013/09/09 04:57:48 Can we use "Delete" command instead of "Cut" comma
+
+ execTypeCharacterCommand('N');
yosin_UTC9 2013/09/09 04:57:48 We don't need to use functions in editor.js.
+ execTypeCharacterCommand('e');
+ execTypeCharacterCommand('w');
+ execTypeCharacterCommand(' ');
+ execTypeCharacterCommand('T');
+ execTypeCharacterCommand('e');
+ execTypeCharacterCommand('x');
+ execTypeCharacterCommand('t');
+
+ span = document.getElementsByTagName("span")[0];
+ green = "rgb(0, 128, 0)";
+
+ shouldBe('span.style.backgroundColor', 'green');
+}
+</script>
+
+<title>Test background color style</title>
+</head>
+
+<body>
+<p>
+ This tests whether background style applied on a selection is retained when the selection is deleted/cut and is replaced with new text.<br>
+ The background color of the text below should be green.
+</p>
+<div id="test" contenteditable>
+Select this text and cut/delete. Type new text, the background color should be green.
+</div>
+<script>
+ runDumpAsTextEditingTest(true);
yosin_UTC9 2013/09/09 04:57:48 This test has shouldBe(), so we don't need to dump
+</script>
+</body>
+
+</html>

Powered by Google App Engine
This is Rietveld 408576698