зеркало из https://github.com/mozilla/pjs.git
Bug 625672. Part 1: Fix scrolling tests to actually test stuff correctly. r=dbaron
This commit is contained in:
Родитель
76dfea6522
Коммит
0348123caf
|
@ -1,12 +1,24 @@
|
|||
var topElements = document.getElementsByClassName("scrollTop");
|
||||
if (!topElements.length) {
|
||||
topElements = [document.body];
|
||||
topElements = [document.documentElement];
|
||||
}
|
||||
|
||||
var failed = false;
|
||||
|
||||
function doScroll(d)
|
||||
{
|
||||
if (failed)
|
||||
return;
|
||||
for (var i = 0; i < topElements.length; ++i) {
|
||||
topElements[i].scrollTop = d;
|
||||
var e = topElements[i];
|
||||
e.scrollTop = d;
|
||||
if (e.scrollTop != d) {
|
||||
document.documentElement.textContent =
|
||||
"Scrolling failed on " + e.tagName + " element, " +
|
||||
"tried to scroll to " + d + ", got " + e.scrollTop +
|
||||
" (Random number: " + Math.random() + ")";
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script src="scrolling.js"></script>
|
||||
<div class="scrollTop" style="height:100px; overflow:auto;">
|
||||
<div class="scrollTop" style="height:100px; overflow:hidden;">
|
||||
<div style="margin-top:30px;">Hello Kitty</div>
|
||||
<div style="height:400px;"></div>
|
||||
</div>
|
||||
<script src="scrolling.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче