mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
add direct event handlers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../testing.js"></script>
|
||||
<script src="../../testing.js"></script>
|
||||
|
||||
<script id=history>
|
||||
testing.expectEqual('auto', history.scrollRestoration);
|
||||
@@ -11,7 +11,7 @@
|
||||
testing.expectEqual('auto', history.scrollRestoration);
|
||||
testing.expectEqual(null, history.state)
|
||||
|
||||
history.pushState({ testInProgress: true }, null, 'http://127.0.0.1:9582/src/tests/html/history2.html');
|
||||
history.pushState({ testInProgress: true }, null, 'http://127.0.0.1:9582/src/tests/html/history/history_after_nav.html');
|
||||
testing.expectEqual({ testInProgress: true }, history.state);
|
||||
|
||||
history.pushState({ testInProgress: false }, null, 'http://127.0.0.1:9582/xhr/json');
|
||||
26
src/tests/html/history/history2.html
Normal file
26
src/tests/html/history/history2.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../../testing.js"></script>
|
||||
|
||||
<script id=history2>
|
||||
history.pushState(
|
||||
{"new": "field", testComplete: true },
|
||||
null,
|
||||
'http://127.0.0.1:9582/src/tests/html/history/history_after_nav.html'
|
||||
);
|
||||
|
||||
let popstateEventFired = false;
|
||||
let popstateEventState = null;
|
||||
|
||||
// uses the window event listener.
|
||||
window.onpopstate = (event) => {
|
||||
popstateEventFired = true;
|
||||
popstateEventState = event.state;
|
||||
};
|
||||
|
||||
testing.eventually(() => {
|
||||
testing.expectEqual(true, popstateEventFired);
|
||||
testing.expectEqual(true, popstateEventState.testComplete);
|
||||
})
|
||||
|
||||
history.back();
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../testing.js"></script>
|
||||
<script src="../../testing.js"></script>
|
||||
|
||||
<script id=history2>
|
||||
testing.expectEqual(true, history.state && history.state.testInProgress);
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../testing.js"></script>
|
||||
<script src="../../testing.js"></script>
|
||||
|
||||
<script id=navigation>
|
||||
testing.expectEqual('object', typeof navigation);
|
||||
@@ -12,7 +12,7 @@
|
||||
const currentIndex = navigation.currentEntry.index;
|
||||
|
||||
navigation.navigate(
|
||||
'http://127.0.0.1:9582/src/tests/html/navigation2.html',
|
||||
'http://127.0.0.1:9582/src/tests/html/navigation/navigation2.html',
|
||||
{ state: { currentIndex: currentIndex, navTestInProgress: true } }
|
||||
);
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../testing.js"></script>
|
||||
<script src="../../testing.js"></script>
|
||||
|
||||
<script id=navigation2>
|
||||
const state = navigation.currentEntry.getState();
|
||||
Reference in New Issue
Block a user