Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / document-dir-property.html
index 84944ac..fce0786 100644 (file)
@@ -1,5 +1,6 @@
 <html>
 <head>
+<link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-dir"/>
 <script>
 var headReadDocumentDir = document.dir;
 document.dir = "rtl";
@@ -7,37 +8,61 @@ var headWriteDocumentDir = document.dir;
 </script>
 </head>
 <body>
-<div id="description"></div>
-<div id="console"></div>
 <script src="../../resources/js-test.js"></script>
 <script>
-description("This tests:<br>"
-          + "Bug 9954 REGRESSION: document.dir should return empty string in &lt;head&gt;<br>"
-          + "<a href=\"https://bugs.webkit.org/show_bug.cgi?id=9954\">https://bugs.webkit.org/show_bug.cgi?id=9954</a><br>");
+description("document.dir should reflect the 'dir' content attribute of the &lt;html&gt; element and should be settable in &lt;head&gt;.");
 
 debug("Read document.dir in head");
-shouldBe("headReadDocumentDir", "''");
+shouldBeEqualToString("headReadDocumentDir", "");
 debug("");
 
 debug("Write document.dir in head");
-shouldBe("headWriteDocumentDir", "''");
+shouldBeEqualToString("headWriteDocumentDir", "rtl");
 debug("");
 
 debug("Read document.dir in body");
-shouldBe("document.dir", "''");
+shouldBeEqualToString("document.dir", "rtl");
+debug("");
+
+debug("Read document.documentElement.dir in body");
+shouldBeEqualToString("document.documentElement.dir", "rtl");
 debug("");
 
 debug("Read document.body.dir in body");
-shouldBe("document.body.dir", "''");
+shouldBeEqualToString("document.body.dir", "");
 debug("");
 
 debug("Write document.dir in body");
 document.dir = "ltr";
-shouldBe("document.dir", "'ltr'");
+shouldBeEqualToString("document.dir", "ltr");
+debug("");
+
+debug("Read document.documentElement.dir in body");
+shouldBeEqualToString("document.documentElement.dir", "ltr");
 debug("");
 
 debug("Read document.body.dir in body");
-shouldBe("document.body.dir", "'ltr'");
+shouldBeEqualToString("document.body.dir", "");
+debug("");
+
+debug("Write non-canonical case document.dir in body");
+shouldNotThrow("document.dir = 'RTL'");
+shouldBeEqualToString("document.dir", "rtl");
+debug("");
+
+debug("Write invalid document.dir in body");
+shouldNotThrow("document.dir = 'WRONG'");
+shouldBeEqualToString("document.dir", "");
+debug("");
+
+debug("Write non-canonical case document.body.dir in body");
+shouldNotThrow("document.body.dir = 'RTL'");
+shouldBeEqualToString("document.body.dir", "rtl");
+debug("");
+
+debug("Write invalid document.body.dir in body");
+shouldNotThrow("document.body.dir = 'WRONG'");
+shouldBeEqualToString("document.body.dir", "");
 debug("");
 </script>
 </body>