Added: trunk/LayoutTests/editing/style/text-decoration-state-change-expected.txt (0 => 157689)
--- trunk/LayoutTests/editing/style/text-decoration-state-change-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/style/text-decoration-state-change-expected.txt 2013-10-20 00:24:40 UTC (rev 157689)
@@ -0,0 +1,23 @@
+Test to make sure we return correct text-decoration state on applying different command.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL textdecorationState("underline","<span id=e style='text-decoration: none !important;'>hello world</span>", "underline") should be false. Was true.
+FAIL textdecorationState("underline","<span id=e style='text-decoration: underline !important;'>hello world</span>", "underline") should be true. Was false.
+FAIL textdecorationState("strikeThrough","<span id=e style='text-decoration: underline !important;'>hello world</span>", "strikethrough") should be false. Was true.
+PASS textdecorationState("strikeThrough","<span style='text-decoration: underline !important;'><em id=e>hello world</em></span>", "strikethrough") is true
+PASS textdecorationState("underline","<span id=e class='underline_important'>hello world</span>", "removeFormat") is true
+PASS textdecorationState("strikeThrough","<span id=e class='linethrough_important'>hello world</span>", "removeFormat") is true
+PASS textdecorationState("underline","<u><span id=e style='text-decoration: underline !important;'>hello world</span></u>", "underline") is false
+PASS textdecorationState("underline","<span id=e style='text-decoration: none;'>hello world</span>", "underline") is true
+PASS textdecorationState("underline","<span id=e style='text-decoration: underline;'>hello world</span>", "underline") is false
+PASS textdecorationState("strikeThrough","<span id=e style='text-decoration: underline;'>hello world</span>", "strikethrough") is true
+PASS textdecorationState("strikeThrough","<span style='text-decoration: underline;'><em id=e>hello world</em></span>", "strikethrough") is true
+FAIL textdecorationState("underline","<span id=e class='underline_decoration'>hello world</span>", "removeFormat") should be false. Was true.
+PASS textdecorationState("strikeThrough","<span id=e class='linethrough_decoration'>hello world</span>", "removeFormat") is true
+PASS textdecorationState("underline","<span id=e style='text-decoration: underline;'>hello world</span>", "removeFormat") is false
+PASS textdecorationState("underline","<span id=e>hello world</span>", "underline") is true
+PASS textdecorationState("underline","<u><span id=e>hello world</span></u>", "underline") is false
+PASS textdecorationState("underline","<u><span id=e style='text-decoration: underline;'>hello world</span></u>", "underline") is false
+
Added: trunk/LayoutTests/editing/style/text-decoration-state-change.html (0 => 157689)
--- trunk/LayoutTests/editing/style/text-decoration-state-change.html (rev 0)
+++ trunk/LayoutTests/editing/style/text-decoration-state-change.html 2013-10-20 00:24:40 UTC (rev 157689)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+<style>
+ .underline_important {
+ text-decoration: underline !important;
+ }
+ .linethrough_important{
+ text-decoration: line-through !important;
+ }
+
+ .underline_decoration {
+ text-decoration: underline;
+ }
+ .linethrough_decoration{
+ text-decoration: line-through;
+ }
+</style>
+</head>
+<body>
+<script>
+description('Test to make sure we return correct text-decoration state on applying different command.');
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+function textdecorationState(decoration, content, command)
+{
+ testContainer.innerHTML = content;
+ var target = document.getElementById('e');
+ var selection = window.getSelection();
+ var range = document.createRange();
+ range.setStart(target, 0);
+ range.setEnd(target, 1);
+ target.focus();
+ selection.removeAllRanges();
+ selection.addRange(range);
+ document.execCommand(command, false, null);
+
+ return document.queryCommandState(decoration);
+}
+
+//!important
+shouldBe('textdecorationState("underline","<span id=e style=\'text-decoration: none !important;\'>hello world</span>", "underline")', 'false');
+shouldBe('textdecorationState("underline","<span id=e style=\'text-decoration: underline !important;\'>hello world</span>", "underline")', 'true');
+shouldBe('textdecorationState("strikeThrough","<span id=e style=\'text-decoration: underline !important;\'>hello world</span>", "strikethrough")', 'false');
+shouldBe('textdecorationState("strikeThrough","<span style=\'text-decoration: underline !important;\'><em id=e>hello world</em></span>", "strikethrough")', 'true');
+shouldBe('textdecorationState("underline","<span id=e class=\'underline_important\'>hello world</span>", "removeFormat")', 'true');
+shouldBe('textdecorationState("strikeThrough","<span id=e class=\'linethrough_important\'>hello world</span>", "removeFormat")', 'true');
+shouldBe('textdecorationState("underline","<u><span id=e style=\'text-decoration: underline !important;\'>hello world</span></u>", "underline")', 'false');
+
+//general
+shouldBe('textdecorationState("underline","<span id=e style=\'text-decoration: none;\'>hello world</span>", "underline")', 'true');
+shouldBe('textdecorationState("underline","<span id=e style=\'text-decoration: underline;\'>hello world</span>", "underline")', 'false');
+shouldBe('textdecorationState("strikeThrough","<span id=e style=\'text-decoration: underline;\'>hello world</span>", "strikethrough")', 'true');
+shouldBe('textdecorationState("strikeThrough","<span style=\'text-decoration: underline;\'><em id=e>hello world</em></span>", "strikethrough")', 'true');
+shouldBe('textdecorationState("underline","<span id=e class=\'underline_decoration\'>hello world</span>", "removeFormat")', 'false');
+shouldBe('textdecorationState("strikeThrough","<span id=e class=\'linethrough_decoration\'>hello world</span>", "removeFormat")', 'true');
+
+shouldBe('textdecorationState("underline","<span id=e style=\'text-decoration: underline;\'>hello world</span>", "removeFormat")', 'false');
+shouldBe('textdecorationState("underline","<span id=e>hello world</span>", "underline")', 'true');
+
+shouldBe('textdecorationState("underline","<u><span id=e>hello world</span></u>", "underline")', 'false');
+shouldBe('textdecorationState("underline","<u><span id=e style=\'text-decoration: underline;\'>hello world</span></u>", "underline")', 'false');
+
+document.body.removeChild(testContainer);
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>