Bug 1544198 - Test cases for the root element. r=jfkthame
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 23 Apr 2019 01:14:37 +0000
changeset 470432 42c76408a8bdeea672dc5144c103cb34fe850b5f
parent 470431 52410914b543300394f6b98c8dd6e3d73fb84780
child 470433 291b093ea26a97f55d0388a134f18dc50184192d
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1544198, 1102175, 1260054
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544198 - Test cases for the root element. r=jfkthame These test cases intentionally check only Y-axis scroll position since horizontal scroll on the root element has been broken, e.g. bug 1102175 or bug 1260054. Differential Revision: https://phabricator.services.mozilla.com/D27988
testing/web-platform/tests/css/css-scroll-snap/scroll-snap-type-on-root-element.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-snap/scroll-snap-type-on-root-element.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-type"/>
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-4/#principal-flow"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+html {
+  height: 3000px;
+  scroll-snap-type: inline mandatory;
+}
+#target {
+  position: absolute;
+  background-color: blue;
+  top: 1000px;
+  width: 100%;
+  height: 100px;
+}
+</style>
+<div id="target"></div>
+<script>
+const documentHeight = document.documentElement.clientHeight;
+test(() => {
+  target.style.scrollSnapAlign = "end start";
+
+  window.scrollTo(0, 1000);
+
+  // `target y (1000px)` + `target height (100px)` - document height.
+  assert_equals(document.scrollingElement.scrollTop, 1100 - documentHeight);
+
+  target.style.scrollSnapAlign = "";
+  window.scrollTo(0, 0);
+}, "The scroll-snap-type on the root element is applied");
+
+test(() => {
+  document.body.style.writingMode = "vertical-rl";
+  target.style.scrollSnapAlign = "start end";
+
+  window.scrollTo(0, 1000);
+  // `target y (1000px)` + `target height (100px)` - document height.
+  assert_equals(document.scrollingElement.scrollTop, 1100 - documentHeight);
+}, "The writing-mode on the body is used");
+</script>