OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 body { | 3 body { |
4 height: 2000px; | 4 height: 2000px; |
5 width: 2000px; | 5 width: 2000px; |
6 } | 6 } |
7 </style> | 7 </style> |
8 | 8 |
9 <body></body> | 9 <body></body> |
10 <script src="../../../resources/testharness.js"></script> | 10 <script src="../../../resources/testharness.js"></script> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 window.addEventListener('hashchange', t.step_func(function() { | 51 window.addEventListener('hashchange', t.step_func(function() { |
52 var key = location.hash, | 52 var key = location.hash, |
53 entry = entries[key]; | 53 entry = entries[key]; |
54 | 54 |
55 if (key === '') { | 55 if (key === '') { |
56 t.done(); | 56 t.done(); |
57 return; | 57 return; |
58 } | 58 } |
59 console.log(`verifying ${key}`); | 59 console.log(`verifying ${key}`); |
60 assert_equals(history.state.key, key, `state should have key: ${key}`); | 60 assert_equals(history.state.key, key, `state should have key: ${key}`); |
61 assert_equals(document.body.scrollLeft, entry.expectedScroll[0], `scrollLe
ft is correct for ${key}`); | 61 assert_equals(document.scrollingElement.scrollLeft, entry.expectedScroll[0
], `scrollLeft is correct for ${key}`); |
62 assert_equals(document.body.scrollTop, entry.expectedScroll[1], `scrollTop
is correct ${key}`); | 62 assert_equals(document.scrollingElement.scrollTop, entry.expectedScroll[1]
, `scrollTop is correct ${key}`); |
63 | 63 |
64 window.history.back(); | 64 window.history.back(); |
65 })); | 65 })); |
66 | 66 |
67 // Reset the scroll and kick off the verification | 67 // Reset the scroll and kick off the verification |
68 setTimeout(function() { | 68 setTimeout(function() { |
69 history.pushState(null, null, '#done'); | 69 history.pushState(null, null, '#done'); |
70 window.scrollTo(555, 555); | 70 window.scrollTo(555, 555); |
71 window.history.back(); | 71 window.history.back(); |
72 }, 0); | 72 }, 0); |
73 | 73 |
74 }, 'history.{push,replace}State retain and respect history.scrollRestoration')
; | 74 }, 'history.{push,replace}State retain and respect history.scrollRestoration')
; |
75 </script> | 75 </script> |
OLD | NEW |