Chromium Code Reviews| 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> |
| + |