|
2 | 2 | <script src="../testing.js"></script> |
3 | 3 |
|
4 | 4 | <script id=history> |
5 | | - testing.expectEqual('auto', history.scrollRestoration); |
| 5 | + testing.expectEqual('auto', history.scrollRestoration); |
6 | 6 |
|
7 | | - history.scrollRestoration = 'manual'; |
8 | | - history.scrollRestoration = 'foo'; |
9 | | - testing.expectEqual('manual', history.scrollRestoration); |
| 7 | + history.scrollRestoration = 'manual'; |
| 8 | + history.scrollRestoration = 'foo'; |
| 9 | + testing.expectEqual('manual', history.scrollRestoration); |
10 | 10 |
|
11 | | - history.scrollRestoration = 'auto'; |
12 | | - testing.expectEqual('auto', history.scrollRestoration); |
| 11 | + history.scrollRestoration = 'auto'; |
| 12 | + testing.expectEqual('auto', history.scrollRestoration); |
| 13 | + testing.expectEqual(null, history.state) |
13 | 14 |
|
14 | | - testing.expectEqual(null, history.state) |
| 15 | + history.pushState({ testInProgress: true }, null, 'http://127.0.0.1:9582/xhr/json'); |
| 16 | + testing.expectEqual({ testInProgress: true }, history.state); |
15 | 17 |
|
16 | | - history.pushState({}, null, ''); |
17 | | - history.replaceState({}, null, ''); |
| 18 | + history.replaceState({ "new": "field", testComplete: true }, null); |
| 19 | + let state = { "new": "field", testComplete: true }; |
| 20 | + testing.expectEqual(state, history.state); |
18 | 21 |
|
19 | | - testing.expectEqual(undefined, history.go()); |
20 | | - testing.expectEqual(undefined, history.go(1)); |
21 | | - testing.expectEqual(undefined, history.go(-1)); |
22 | | - testing.expectEqual(undefined, history.forward()); |
23 | | - testing.expectEqual(undefined, history.back()); |
24 | | -</script> |
| 22 | + testing.expectEqual(undefined, history.back()); |
| 23 | + testing.expectEqual(undefined, history.forward()); |
25 | 24 |
|
26 | | -<script id=history-states> |
27 | | - testing.expectEqual(null, history.state) |
| 25 | + testing.onPageWait(() => { |
| 26 | + testing.expectEqual(true, history.state && history.state.testComplete); |
| 27 | + testing.expectEqual(state, history.state); |
| 28 | + }); |
28 | 29 |
|
29 | | - history.pushState({}, { "abc": "def" }, ''); |
30 | | - testing.expectEqual({ "abc": "def"}, history.state); |
| 30 | + testing.expectEqual(undefined, history.go()); |
31 | 31 | </script> |
0 commit comments