Index: LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html |
diff --git a/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html b/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2cbf8ddb4851229eaab05a8ba716a0af5117554e |
--- /dev/null |
+++ b/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html |
@@ -0,0 +1,76 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+ <script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+ <div id="container" style="overflow: scroll; height: 200px; width: 200px"> |
+ <div style="height: 1000px; width: 1000px; border: 1px solid black;"> |
+ This box should force the container div to have a scrollable area to test. |
+ </div> |
+ </div> |
+ <script type="text/javascript"> |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ var element = document.getElementById("container"); |
+ |
+ description("This test makes sure setting scrollLeft or scrollTop to\ |
+ an invalid value throws an exception."); |
+ |
+ // scrollLeft ///////////////////////// |
+ debug(''); |
+ debug('scrollLeft Tests'); |
+ debug(''); |
+ |
+ debug("Testing - setting scrollLeft to a valid value"); |
+ shouldNotThrow('element.scrollLeft = 32'); |
+ shouldNotThrow('element.scrollLeft = 32.1'); |
+ shouldNotThrow('element.scrollLeft = "string"'); |
+ shouldNotThrow('element.scrollLeft = null'); |
+ shouldNotThrow('element.scrollLeft = undefined'); |
+ shouldNotThrow('element.scrollLeft = Infinity'); |
+ shouldNotThrow('element.scrollLeft = NaN'); |
+ shouldNotThrow('element.scrollLeft = { x: 42 }'); |
+ shouldNotThrow('element.scrollLeft = { x: 42, behavior: "auto" }'); |
+ shouldNotThrow('element.scrollLeft = { x: 42, behavior: "instant" }'); |
+ shouldNotThrow('element.scrollLeft = { x: 42, behavior: "smooth" }'); |
+ |
+ debug("Testing - setting scrollLeft to an invalid value"); |
+ shouldThrow('element.scrollLeft = { }'); |
+ shouldThrow('element.scrollLeft = { x: 42, behavior: "" }'); |
+ shouldThrow('element.scrollLeft = { x: 42, behavior: "abcd" }'); |
+ shouldThrow('element.scrollLeft = { behavior: "abcd" }'); |
+ shouldThrow('element.scrollLeft = { behavior: "smooth" }'); |
+ shouldThrow('element.scrollLeft = { behavior: "instant" }'); |
+ shouldThrow('element.scrollLeft = { behavior: "smooth" }'); |
+ |
+ // scrollTop ///////////////////////// |
+ debug(''); |
+ debug('scrollTop Tests'); |
+ debug(''); |
+ |
+ debug("Testing - setting scrollTop to a valid value"); |
+ shouldNotThrow('element.scrollTop = 32'); |
+ shouldNotThrow('element.scrollTop = 32.1'); |
+ shouldNotThrow('element.scrollTop = "string"'); |
+ shouldNotThrow('element.scrollTop = null'); |
+ shouldNotThrow('element.scrollTop = undefined'); |
+ shouldNotThrow('element.scrollTop = Infinity'); |
+ shouldNotThrow('element.scrollTop = NaN'); |
+ shouldNotThrow('element.scrollTop = { y: 42 }'); |
+ shouldNotThrow('element.scrollTop = { y: 42, behavior: "auto" }'); |
+ shouldNotThrow('element.scrollTop = { y: 42, behavior: "instant" }'); |
+ shouldNotThrow('element.scrollTop = { y: 42, behavior: "smooth" }'); |
+ |
+ debug("Testing - setting scrollTop to an invalid value"); |
+ shouldThrow('element.scrollTop = { }'); |
+ shouldThrow('element.scrollTop = { y: 42, behavior: "" }'); |
+ shouldThrow('element.scrollTop = { y: 42, behavior: "abcd" }'); |
+ shouldThrow('element.scrollTop = { behavior: "abcd" }'); |
+ shouldThrow('element.scrollTop = { behavior: "smooth" }'); |
+ shouldThrow('element.scrollTop = { behavior: "instant" }'); |
+ shouldThrow('element.scrollTop = { behavior: "smooth" }'); |
+ </script> |
+</body> |
+</html> |