Update web-platform-tests to revision ea14651f262003177d0ba5819bd2806a1327b12a

This commit is contained in:
WPT Sync Bot 2018-04-30 21:09:29 -04:00
parent 847115ba04
commit 816185f094
272 changed files with 5766 additions and 2855 deletions

View file

@ -56,5 +56,85 @@
window.scrollTo(0, 0);
}, "BODY element scroll-behavior should not propagate to viewport");
var instantHistoryNavigationTest =
async_test("Instant scrolling while doing history navigation.");
var smoothHistoryNavigationTest =
async_test("Smooth scrolling while doing history navigation.");
function instant() {
document.documentElement.className = "";
document.body.className = "";
window.scrollTo(0, 0);
var p = document.createElement("pre");
p.textContent = new Array(1000).join("newline\n");
var a = document.createElement("a");
a.href = "#";
a.name = "foo";
a.textContent = "foo";
p.appendChild(a);
document.body.appendChild(p);
window.onhashchange = function() {
window.onhashchange = function() {
instantHistoryNavigationTest.step(function() {
assert_equals(location.hash, "", "Shouldn't be scrolled to a fragment.");
assert_equals(window.scrollY, 0, "Shouldn't be scrolled back to top yet.");
});
p.remove();
instantHistoryNavigationTest.done();
smooth();
}
instantHistoryNavigationTest.step(function() {
assert_equals(location.hash, "#foo", "Should be scrolled to a fragment.");
assert_not_equals(window.scrollY, 0, "Shouldn't be scrolled to top anymore.");
});
history.back();
}
instantHistoryNavigationTest.step(function() {
assert_equals(window.scrollY, 0, "Should be scrolled to top.");
assert_equals(location.hash, "", "Shouldn't be scrolled to a fragment.");
});
location.hash = "foo";
};
instant();
function smooth() {
document.documentElement.className = "";
document.body.className = "";
window.scrollTo(0, 0);
var p = document.createElement("pre");
p.textContent = new Array(1000).join("newline\n");
var a = document.createElement("a");
a.href = "#";
a.name = "bar";
a.textContent = "bar";
p.appendChild(a);
document.body.appendChild(p);
window.onhashchange = function() {
window.onhashchange = function() {
smoothHistoryNavigationTest.step(function() {
assert_equals(location.hash, "", "Shouldn't be scrolled to a fragment.");
assert_not_equals(window.scrollY, 0, "Shouldn't be scrolled back to top yet.");
});
p.remove();
smoothHistoryNavigationTest.done();
}
smoothHistoryNavigationTest.step(function() {
assert_equals(location.hash, "#bar", "Should be scrolled to a fragment.");
assert_not_equals(window.scrollY, 0, "Shouldn't be scrolled to top anymore.");
});
history.back();
}
smoothHistoryNavigationTest.step(function() {
assert_equals(window.scrollY, 0, "Should be scrolled to top.");
assert_equals(location.hash, "", "Shouldn't be scrolled to a fragment.");
});
location.hash = "bar";
document.documentElement.className = "smooth";
};
testContainer.style.display = "none";
</script>