mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Add tests for bugs 66619 and 388019.
This commit is contained in:
parent
f367e18bc7
commit
d40a9a5bb7
@ -42,6 +42,10 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifdef MOZ_MOCHITEST
|
||||
DIRS += tests
|
||||
endif
|
||||
|
||||
MODULE = layout
|
||||
XPIDL_MODULE = layout_base
|
||||
GRE_MODULE = 1
|
||||
|
@ -39,9 +39,12 @@ DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = layout/base/tests
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifeq (0,1) # false, since TestSpaceManager is broken
|
||||
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
@ -69,6 +72,20 @@ LIBS += \
|
||||
$(TK_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
endif # false
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
||||
ifdef MOZ_MOCHITEST
|
||||
|
||||
_TEST_FILES = \
|
||||
test_bug66619.html \
|
||||
test_bug388019.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
endif # MOZ_MOCHITEST
|
||||
|
45
layout/base/tests/test_bug388019.html
Normal file
45
layout/base/tests/test_bug388019.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=388019
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 388019</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=388019">Mozilla Bug 388019</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 388019 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run()
|
||||
{
|
||||
var oldY = window.scrollY;
|
||||
window.location.hash="#abc";
|
||||
var newY = window.scrollY;
|
||||
isnot(oldY, newY, "we scroll at all");
|
||||
ok(oldY + 4000 < newY, "we scroll at least 4000 pixels");
|
||||
window.scrollTo(0, 0); // make the results visible
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<div style="height:4000px"></div>
|
||||
<a name="abc"></a>You should see this text if you click on the link.
|
||||
<div style="height:4000px"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
63
layout/base/tests/test_bug66619.html
Normal file
63
layout/base/tests/test_bug66619.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=66619
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 66619</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=66619">Mozilla Bug 66619</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 66619 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run()
|
||||
{
|
||||
is(window.scrollY, 0, "window should initially be at top");
|
||||
|
||||
document.getElementById("first").focus();
|
||||
var first = window.scrollY;
|
||||
isnot(first, 0, "we scrolled to first anchor");
|
||||
ok(first + window.innerHeight > 4000,
|
||||
"we scrolled enough to show the anchor");
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById("second").focus();
|
||||
var second = window.scrollY;
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById("third").focus();
|
||||
var third = window.scrollY;
|
||||
|
||||
is(second, first, "we scrolled the second line of the anchor into view");
|
||||
isnot(third, second, "we scrolled the second line of the anchor into view");
|
||||
ok(third > second, "we scrolled the second line of the anchor into view");
|
||||
|
||||
window.scrollTo(0, 0); // make the results visible
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<div style="height:4000px"></div>
|
||||
<a id="first" href="http://www.mozilla.org/">first<br>link</a>
|
||||
<a id="second" href="http://www.mozilla.org/">second link</a>
|
||||
<a id="third" href="http://www.mozilla.org/">third<br>link</a>
|
||||
<div style="height:4000px"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user