forked from ruffle-rs/ruffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Checks that iframe correctly fires its onload event
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
web/packages/selfhosted/test/polyfill/iframes_onload/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test_ok |
18 changes: 18 additions & 0 deletions
18
web/packages/selfhosted/test/polyfill/iframes_onload/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
11 changes: 11 additions & 0 deletions
11
web/packages/selfhosted/test/polyfill/iframes_onload/inner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>iframe onload</title> | ||
</head> | ||
|
||
<body> | ||
Hello World! | ||
</body> | ||
</html> |
21 changes: 21 additions & 0 deletions
21
web/packages/selfhosted/test/polyfill/iframes_onload/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); |