blob: ff558ebec7a30e0180c6454109c8e509d5043f03 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<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.testRunner)
testRunner.dumpAsText();
reset();
description("This test makes sure that calling the window scrolling\
methods with less than 2 arguments treats the missing arguments as 0.");
// 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 + x');
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 + x');
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 + x');
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();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>