| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <style> | 2 <style> |
| 3 body { | 3 body { |
| 4 height: 2000px; | 4 height: 10000px; |
| 5 width: 2000px; | 5 width: 10000px; |
| 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> |
| 11 <script src="../../../resources/testharnessreport.js"></script> | 11 <script src="../../../resources/testharnessreport.js"></script> |
| 12 <script type="text/javascript"> | 12 <script type="text/javascript"> |
| 13 'use strict'; | 13 'use strict'; |
| 14 | 14 |
| 15 async_test(function(t) { | 15 async_test(function(t) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 38 history.pushState.apply(history, args); | 38 history.pushState.apply(history, args); |
| 39 } else { | 39 } else { |
| 40 history.pushState(null, '', key); | 40 history.pushState(null, '', key); |
| 41 history.replaceState.apply(history, args); | 41 history.replaceState.apply(history, args); |
| 42 } | 42 } |
| 43 assert_equals(history.scrollRestoration, beforeValue, `${entry.type} retai
n current history.scrollRestoration value`); | 43 assert_equals(history.scrollRestoration, beforeValue, `${entry.type} retai
n current history.scrollRestoration value`); |
| 44 history.scrollRestoration = newValue; | 44 history.scrollRestoration = newValue; |
| 45 assert_equals(history.scrollRestoration, newValue, `Setting scrollRestorat
ion to ${newValue} does expected`); | 45 assert_equals(history.scrollRestoration, newValue, `Setting scrollRestorat
ion to ${newValue} does expected`); |
| 46 window.scrollBy(50, 100); | 46 window.scrollBy(50, 100); |
| 47 } | 47 } |
| 48 assert_equals(history.length, 5, 'history entries match expectation'); | |
| 49 | 48 |
| 50 // setup verification | 49 // setup verification |
| 51 window.addEventListener('hashchange', t.step_func(function() { | 50 window.addEventListener('hashchange', t.step_func(function() { |
| 52 var key = location.hash, | 51 var key = location.hash, |
| 53 entry = entries[key]; | 52 entry = entries[key]; |
| 54 | 53 |
| 55 if (key === '') { | 54 if (key === '') { |
| 56 t.done(); | 55 t.done(); |
| 57 return; | 56 return; |
| 58 } | 57 } |
| 59 console.log(`verifying ${key}`); | 58 console.log(`verifying ${key}`); |
| 60 assert_equals(history.state.key, key, `state should have key: ${key}`); | 59 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}`); | 60 assert_equals(document.body.scrollLeft, entry.expectedScroll[0], `scrollLe
ft is correct for ${key}`); |
| 62 assert_equals(document.body.scrollTop, entry.expectedScroll[1], `scrollTop
is correct ${key}`); | 61 assert_equals(document.body.scrollTop, entry.expectedScroll[1], `scrollTop
is correct ${key}`); |
| 63 | 62 |
| 64 window.history.back(); | 63 window.history.back(); |
| 65 })); | 64 })); |
| 66 | 65 |
| 67 // Reset the scroll and kick off the verification | 66 // reset the scroll and kick off the verification |
| 68 setTimeout(function() { | 67 setTimeout(function() { |
| 69 history.pushState(null, null, '#done'); | 68 history.pushState(null, null, '#done'); |
| 70 window.scrollTo(555, 555); | 69 window.scrollTo(555, 555); |
| 71 window.history.back(); | 70 window.history.back(); |
| 72 }, 0); | 71 }, 0); |
| 73 | 72 |
| 74 }, 'history.{push,replace}State retain and respect history.scrollRestoration')
; | 73 }, 'history.{push,replace}State retain and respect history.scrollRestoration')
; |
| 75 </script> | 74 </script> |
| OLD | NEW |