mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:07:34 +00:00
Tests/LibWeb: Move LibWeb test frames to their own directory
We currently have a handful of iframe tests whose sources are in the "input" directory. This means they get run as their own tests, when they are really just helper files. We've had to add empty test expectation files for these "tests", and invoke a dummy test() method just to keep the test runner happy. Instead, move them to their own directory so the test runner does not see them at all.
This commit is contained in:
parent
f77e91e0f0
commit
e030193e5f
14 changed files with 30 additions and 50 deletions
15
Tests/LibWeb/Text/data/history-pushstate-iframe.html
Normal file
15
Tests/LibWeb/Text/data/history-pushstate-iframe.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<script>
|
||||
try {
|
||||
const initialHistoryLength = window.history.length;
|
||||
|
||||
history.pushState({}, "hello", "history-pushstate-iframe.html#hello");
|
||||
|
||||
parent.postMessage(
|
||||
"history object length has changed by " +
|
||||
(window.history.length - initialHistoryLength),
|
||||
"*"
|
||||
);
|
||||
} catch (e) {
|
||||
parent.postMessage("ERROR:" + e, "*");
|
||||
}
|
||||
</script>
|
3
Tests/LibWeb/Text/data/iframe-test-content-1.html
Normal file
3
Tests/LibWeb/Text/data/iframe-test-content-1.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<script>
|
||||
parent.postMessage("message from test iframe (1)", "*");
|
||||
</script>
|
3
Tests/LibWeb/Text/data/iframe-test-content-2.html
Normal file
3
Tests/LibWeb/Text/data/iframe-test-content-2.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<script>
|
||||
parent.postMessage("message from test iframe (2)", "*");
|
||||
</script>
|
78
Tests/LibWeb/Text/data/navigation-navigate-iframe.html
Normal file
78
Tests/LibWeb/Text/data/navigation-navigate-iframe.html
Normal file
|
@ -0,0 +1,78 @@
|
|||
<script>
|
||||
function filename(path) {
|
||||
url = new URL(path)
|
||||
return url.pathname.split('/').pop() + url.hash
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
parent.postMessage(`Initial history length is ${navigation.entries().length}`, "*");
|
||||
|
||||
navigation.oncurrententrychange = (e) => {
|
||||
parent.postMessage(`${e.type} for change to ${filename(navigation.currentEntry.url)} of type ${e.navigationType} from ${filename(e.from.url)}`, "*");
|
||||
}
|
||||
|
||||
navigation.onnavigate = (e) => {
|
||||
parent.postMessage(`NavigateEvent for ${e.navigationType} ${filename(e.destination.url)} (Same document? ${e.destination.sameDocument}) with info: ${e.info}`, "*")
|
||||
}
|
||||
|
||||
// Navigate to fragment
|
||||
let a = navigation.navigate("navigation-navigate-iframe.html#1", { info: 42, history: "push" });
|
||||
|
||||
await a.committed.then((f) => {
|
||||
parent.postMessage(`Committed to navigation to ${filename(f.url)}`, "*");
|
||||
},
|
||||
(e) => {
|
||||
parent.postMessage("ERROR:" + e, "*", "*");
|
||||
})
|
||||
|
||||
await a.finished.then((f) => {
|
||||
parent.postMessage(`Finished navigation to ${filename(f.url)}`, "*");
|
||||
},
|
||||
(e) => {
|
||||
parent.postMessage("ERROR:" + e, "*");
|
||||
})
|
||||
|
||||
parent.postMessage(`History length after navigate is ${navigation.entries().length}`, "*");
|
||||
|
||||
// FIXME: Enable these tests 😅
|
||||
// Navigate backwards
|
||||
// let b = navigation.back()
|
||||
// await b.committed.then((f) => {
|
||||
// parent.postMessage(`Committed to back navigation to ${filename(f.url)}`, "*");
|
||||
// },
|
||||
// (e) => {
|
||||
// parent.postMessage("ERROR:" + e, "*", "*");
|
||||
// })
|
||||
// await b.finished.then((f) => {
|
||||
// parent.postMessage(`Finished back navigation to ${filename(f.url)}`, "*");
|
||||
// },
|
||||
// (e) => {
|
||||
// parent.postMessage("ERROR:" + e, "*");
|
||||
// })
|
||||
|
||||
// parent.postMessage(`History length after back is ${navigation.entries().length}`, "*");
|
||||
|
||||
// Navigate forwards
|
||||
// let c = navigation.forward()
|
||||
// await c.committed.then((f) => {
|
||||
// parent.postMessage(`Committed to forward navigation to ${filename(f.url)}`, "*");
|
||||
// },
|
||||
// (e) => {
|
||||
// parent.postMessage("ERROR:" + e, "*", "*");
|
||||
// })
|
||||
// await c.finished.then((f) => {
|
||||
// parent.postMessage(`Finished forward navigation to ${filename(f.url)}`, "*");
|
||||
// },
|
||||
// (e) => {
|
||||
// parent.postMessage("ERROR:" + e, "*");
|
||||
// })
|
||||
|
||||
// parent.postMessage(`History length after forward is ${navigation.entries().length}`, "*");
|
||||
|
||||
} catch (e) {
|
||||
parent.postMessage("ERROR:" + e, "*");
|
||||
}
|
||||
parent.postMessage("DONE", "*");
|
||||
})();
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue