summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html')
-rw-r--r--testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html95
1 files changed, 95 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html b/testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html
new file mode 100644
index 0000000000..607e7c2936
--- /dev/null
+++ b/testing/web-platform/tests/css/css-position/sticky/position-sticky-grid.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<title>position:sticky elements should work correctly with grid layout</title>
+<link rel="match" href="position-sticky-grid-ref.html" />
+<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
+<meta name="assert" content="This test checks that position:sticky elements interoperate correctly with grid" />
+
+<script src="../resources/ref-rectangle.js"></script>
+
+<style>
+.scroller {
+ position: relative;
+ overflow-x: scroll;
+ overflow-y: hidden;
+ width: 300px;
+ height: 100px;
+ margin-bottom: 15px;
+}
+
+.grid-container {
+ display: grid;
+ grid-template-columns: 25% 25% 25% 25%;
+ grid-template-rows: 100%;
+ width: 400px;
+ height: 90px;
+}
+
+.sticky {
+ position: sticky;
+ left: 50px;
+}
+
+.green {
+ background-color: green;
+}
+
+.grid-item {
+ width: 100%;
+ height: 100%;
+ grid-row: 1;
+}
+
+.indicator {
+ position: absolute;
+ background-color: red;
+ width: 100px;
+ height: 90px;
+}
+
+.padding {
+ height: 1px;
+ width: 700px;
+}
+
+</style>
+
+<script>
+window.addEventListener('load', function() {
+ document.getElementById('scroller1').scrollLeft = 0;
+ document.getElementById('scroller2').scrollLeft = 150;
+ document.getElementById('scroller3').scrollLeft = 300;
+ createIndicatorForStickyElements(document.querySelectorAll('.sticky'));
+});
+</script>
+
+<p>You should see three green boxes of varying size below. There should be no red or blue.</p>
+
+<div id="scroller1" class="scroller">
+ <div class="grid-container">
+ <div class="indicator" style="left: 100px;"></div>
+ <div class="grid-item" style="grid-column: 1;"></div>
+ <div class="sticky green grid-item" style="grid-column: 2;"></div>
+ <div class="green grid-item" style="grid-column: 3;"></div>
+ </div>
+ <div class="padding"></div>
+</div>
+
+<div id="scroller2" class="scroller">
+ <div class="grid-container">
+ <div class="indicator" style="left: 200px;"></div>
+ <div class="grid-item" style="grid-column: 1;"></div>
+ <div class="sticky green grid-item" style="grid-column: 2;"></div>
+ <div class="green grid-item" style="grid-column: 3;"></div>
+ </div>
+ <div class="padding"></div>
+</div>
+
+<div id="scroller3" class="scroller">
+ <div class="grid-container">
+ <div class="indicator" style="left: 300px;"></div>
+ <div class="grid-item" style="grid-column: 1;"></div>
+ <div class="sticky green grid-item" style="grid-column: 2;"></div>
+ <div class="green grid-item" style="grid-column: 3;"></div>
+ </div>
+ <div class="padding"></div>
+</div>