Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html

Issue 2907243002: Sticky position should be observable by getBoundingClientRect (Closed)
Patch Set: Use js test instead of ref test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html
new file mode 100644
index 0000000000000000000000000000000000000000..c90ff33ab31a43012a5bd6d299427789ae7b98e0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<title>Sticky positioned element should behave correctly when style changes</title>
flackr 2017/05/31 21:10:23 same as below comment. "behave correctly" is a lit
yigu 2017/05/31 21:31:33 Done.
+<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
+<meta name="assert" content="This test checks that sticky positioned element behaves correctly when style changes." />
flackr 2017/05/31 21:10:23 Same
yigu 2017/05/31 21:31:33 Done.
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<style>
+body {
+ margin: 0;
+}
+
+.container {
+ overflow: scroll;
+ width: 200px;
+ height: 200px;
+}
+
+.spacer {
+ height: 2000px;
+}
+
+.box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ top: 50px;
+}
+
+.sticky {
+ position: sticky;
+}
+</style>
+
+<div id="scroller" class="container">
+ <div id="sticky" class="sticky box"></div>
+ <div class="spacer"></div>
+</div>
+
+<script>
+test(() => {
+ var element = document.getElementById('sticky');
+ assert_equals(element.getBoundingClientRect().top, 50);
+ document.getElementById('scroller').scrollTop = 100;
+ assert_equals(element.getBoundingClientRect().top, 50);
+ sticky.style.position = 'relative';
+ assert_equals(element.getBoundingClientRect().top, -50);
+ sticky.style.position = 'sticky';
+ assert_equals(element.getBoundingClientRect().top, 50);
+}, 'sticky positioned element should behaves correctly upon style changes.');
flackr 2017/05/31 21:10:23 nit: title should exactly reflect the test. How ab
yigu 2017/05/31 21:31:33 Done.
+</script>
+
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698