blob: a31fc0f3f0354b3d073db5929214e7169d3190f7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<div style="height: 1000px; width: 1000px; border: 1px solid black;">This box should force the window to have a scrollable area to test.</div>
<script language="JavaScript" type="text/javascript">
var resetX;
var resetY;
var x = 25;
var y = 50;
function reset()
{
window.scrollTo(0,0);
resetX = window.scrollX;
resetY = window.scrollY;
}
if (window.layoutTestController)
layoutTestController.dumpAsText();
reset();
description("This test makes sure that we don't allow calling the window scrolling\
methods with less than 2 arguments and that we do allow calling them with more.");
// scrollTo /////////////////////////
debug('');
debug('window.scrollTo Tests');
debug('');
debug("Testing - scrollTo with 0 arguments");
window.scrollTo();
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scrollTo with 1 argument");
window.scrollTo(x);
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scrollTo with more than 2 arguments");
window.scrollTo(x, y, 200, "text");
shouldBe('window.scrollX', 'x');
shouldBe('window.scrollY', 'y');
reset();
// scroll /////////////////////////
debug('');
debug('window.scroll Tests');
debug('');
debug("Testing - scroll with 0 arguments");
window.scroll();
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scroll with 1 argument");
window.scroll(x);
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scroll with more than 2 arguments");
window.scroll(x, y, 200, "text");
shouldBe('window.scrollX', 'x');
shouldBe('window.scrollY', 'y');
reset();
// scrollBy /////////////////////////
debug('');
debug('window.scrollBy Tests');
debug('');
debug("Testing - scrollBy with 0 arguments");
window.scrollBy();
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scrollBy with 1 argument");
window.scrollBy(x);
shouldBe('window.scrollX', 'resetX');
shouldBe('window.scrollY', 'resetY');
reset();
debug("Testing - scrollBy with more than 2 arguments");
window.scrollBy(x, y, 200, "text");
shouldBe('window.scrollX', 'resetX + x');
shouldBe('window.scrollY', 'resetY + y');
reset();
var successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>