tests: Checks that iframe correctly fires its onload event
This commit is contained in:
parent
07d3e7d81b
commit
83fcd7ba40
|
@ -0,0 +1 @@
|
|||
test_ok
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iframe onload</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
function setBody(elm) {
|
||||
document.body.innerHTML = '<div id="container">' + elm.id + '</div>';
|
||||
}
|
||||
window.setTimeout(() => {
|
||||
document.body.innerHTML = '<iframe id="test_ok" src="inner.html" onload="setBody(this);"></iframe>';
|
||||
}, 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iframe onload</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Hello World!
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
const { open_test, inject_ruffle_and_wait } = require("../utils");
|
||||
const { expect, use } = require("chai");
|
||||
const chaiHtml = require("chai-html");
|
||||
const fs = require("fs");
|
||||
|
||||
use(chaiHtml);
|
||||
|
||||
describe("iframe onload", () => {
|
||||
it("loads the test", () => {
|
||||
open_test(browser, __dirname);
|
||||
});
|
||||
|
||||
it("runs the iframe onload event", () => {
|
||||
inject_ruffle_and_wait(browser);
|
||||
browser.$("<div />").waitForExist();
|
||||
|
||||
const actual = browser.$("#container").getHTML(false);
|
||||
const expected = fs.readFileSync(`${__dirname}/expected.html`, "utf8");
|
||||
expect(actual).html.to.equal(expected);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue