Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script src="../../../resources/js-test.js"></script> | |
| 2 <style> | |
| 3 body { | |
| 4 margin: 0px; height: 2000px; width: 2000px; | |
|
ojan
2016/04/19 21:34:24
Not a big deal, but the de facto standard for test
ymalik
2016/04/22 20:41:05
Done.
| |
| 5 } | |
| 6 | |
| 7 #first { | |
| 8 height: 1000px; background-color: #FFA5D2; | |
| 9 } | |
| 10 | |
| 11 #anchor { | |
| 12 position: absolute; background-color: #84BE6A; | |
| 13 height: 600px; width: 100%; | |
| 14 } | |
| 15 | |
| 16 #fragment { | |
| 17 position: relative; background-color: orange; | |
| 18 height: 200px; width: 200px; margin: 10px; | |
| 19 } | |
| 20 </style> | |
| 21 | |
| 22 <script> | |
| 23 window.jsTestIsAsync = true; | |
| 24 setPrintTestResultsLazily(); | |
| 25 | |
| 26 description("This test ensures that scroll anchoring interacts correctly with\ | |
|
ojan
2016/04/19 21:34:24
We don't usually have a line length limit on layou
ymalik
2016/04/22 20:41:05
This is removed in the new test.
| |
| 27 fragment scrolls."); | |
| 28 | |
| 29 onload = function() { | |
| 30 if (!window.internals) { | |
| 31 finishJSTest(); | |
| 32 return; | |
| 33 } | |
| 34 | |
| 35 internals.settings.setScrollAnchoringEnabled(true); | |
| 36 | |
| 37 // Scroll to fragment. | |
| 38 window.location.hash = 'fragment'; | |
| 39 requestAnimationFrame(function() { | |
| 40 // Height of first + fragment margin-top. | |
| 41 shouldBe('document.scrollingElement.scrollTop', '1010'); | |
| 42 | |
| 43 // Change height of content above fragment. | |
| 44 var ch = document.getElementById('changer'); | |
| 45 ch.style.height = 100; | |
| 46 // Height of first + height changer + fragment margin-top. | |
| 47 shouldBe('document.scrollingElement.scrollTop', '1110'); | |
| 48 finishJSTest(); | |
| 49 }); | |
| 50 } | |
| 51 </script> | |
| 52 | |
| 53 <div id="first"></div> | |
| 54 <div id="changer"></div> | |
| 55 <div id="anchor"> | |
| 56 <div id="fragment" name="fragment"></div> | |
| 57 </div> | |
| OLD | NEW |