Title: [157689] trunk/LayoutTests
Revision
157689
Author
[email protected]
Date
2013-10-19 17:24:40 -0700 (Sat, 19 Oct 2013)

Log Message

Adding test case for text-decoration property state change on applying different command
https://bugs.webkit.org/show_bug.cgi?id=123073

Patch by Santosh Mahto <[email protected]> on 2013-10-19
Reviewed by Ryosuke Niwa.

This test case verify text-decoration property state on element after
applying editing commands related to text-decoration.

* editing/style/text-decoration-state-change-expected.txt: Added.
* editing/style/text-decoration-state-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (157688 => 157689)


--- trunk/LayoutTests/ChangeLog	2013-10-20 00:01:17 UTC (rev 157688)
+++ trunk/LayoutTests/ChangeLog	2013-10-20 00:24:40 UTC (rev 157689)
@@ -1,3 +1,16 @@
+2013-10-19  Santosh Mahto  <[email protected]>
+
+        Adding test case for text-decoration property state change on applying different command
+        https://bugs.webkit.org/show_bug.cgi?id=123073
+
+        Reviewed by Ryosuke Niwa.
+
+        This test case verify text-decoration property state on element after
+        applying editing commands related to text-decoration.
+
+        * editing/style/text-decoration-state-change-expected.txt: Added.
+        * editing/style/text-decoration-state-change.html: Added.
+
 2013-10-19  Alexey Proskuryakov  <[email protected]>
 
         WebAudio Mac expected results were misplaced - they apply equally to WK1 and WK2.

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>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to