mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +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
Notes:
sideshowbarker
2024-07-17 03:25:24 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/e030193e5f Pull-request: https://github.com/SerenityOS/serenity/pull/23262 Reviewed-by: https://github.com/kalenikaliaksandr ✅
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>
|
|
@ -1,15 +1,10 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
function filename(path) {
|
||||
url = new URL(path)
|
||||
return url.pathname.split('/').pop() + url.hash
|
||||
}
|
||||
asyncTest(async done => {
|
||||
if (window.self === window.top) {
|
||||
test(() => {});
|
||||
return;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
parent.postMessage(`Initial history length is ${navigation.entries().length}`, "*");
|
||||
|
||||
|
@ -74,10 +69,10 @@
|
|||
// })
|
||||
|
||||
// parent.postMessage(`History length after forward is ${navigation.entries().length}`, "*");
|
||||
|
||||
|
||||
} catch (e) {
|
||||
parent.postMessage("ERROR:" + e, "*");
|
||||
}
|
||||
parent.postMessage("DONE", "*");
|
||||
});
|
||||
})();
|
||||
</script>
|
|
@ -1,20 +0,0 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
try {
|
||||
const initialHistoryLength = window.history.length;
|
||||
|
||||
history.pushState({}, "hello", "history-pushstate-iframe.html#hello");
|
||||
|
||||
if (window.self !== window.top) {
|
||||
parent.postMessage(
|
||||
"history object length has changed by " +
|
||||
(window.history.length - initialHistoryLength),
|
||||
"*"
|
||||
);
|
||||
} else {
|
||||
test(() => {});
|
||||
}
|
||||
} catch (e) {
|
||||
if (window.self !== window.top) parent.postMessage("ERROR:" + e, "*");
|
||||
}
|
||||
</script>
|
|
@ -18,6 +18,6 @@
|
|||
done();
|
||||
});
|
||||
|
||||
await navigateIframe("./history-pushstate-iframe.html");
|
||||
});
|
||||
await navigateIframe("../../data/history-pushstate-iframe.html");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
await navigateIframe("iframe-test-content-1.html");
|
||||
await navigateIframe("iframe-test-content-2.html");
|
||||
await navigateIframe("../../data/iframe-test-content-1.html");
|
||||
await navigateIframe("../../data/iframe-test-content-2.html");
|
||||
});
|
||||
</script>
|
||||
<iframe id="testIframe" src="about:blank"></iframe>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
if (window.self !== window.top) {
|
||||
parent.postMessage("message from test iframe (1)", "*");
|
||||
} else {
|
||||
test(() => {});
|
||||
}
|
||||
</script>
|
|
@ -1,8 +0,0 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
if (window.self !== window.top) {
|
||||
parent.postMessage("message from test iframe (2)", "*");
|
||||
} else {
|
||||
test(() => {});
|
||||
}
|
||||
</script>
|
|
@ -19,6 +19,6 @@
|
|||
done();
|
||||
});
|
||||
|
||||
await navigateIframe("./navigation-navigate-iframe.html");
|
||||
});
|
||||
await navigateIframe("../../data/navigation-navigate-iframe.html");
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue