-
-
Notifications
You must be signed in to change notification settings - Fork 939
web: Polyfill document.embeds to return ruffle-embeds too #22449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e407d3e
776d404
598d8f0
59263f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>DOCUMENT EMBEDS</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div id="test-container"> | ||
| <embed id="emb1" name="fl" src="/test_assets/example.swf" width="200" height="200"></embed> | ||
| <embed id="emb2" name="fl" src="/test_assets/example.swf" width="200" height="200"></embed> | ||
| <embed id="emb3" name="fl" src="/test_assets/example.swf" width="200" height="200"></embed> | ||
| </div> | ||
| <ul id="output"></ul> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { injectRuffleAndWait, openTest, playAndMonitor } from "../../utils.js"; | ||
| import { expect } from "chai"; | ||
|
|
||
| describe("Document embeds", () => { | ||
| it("loads the test", async () => { | ||
| await openTest(browser, `polyfill/document_embeds`); | ||
| }); | ||
|
|
||
| it("Accesses the right number of elements with ruffle", async () => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: other cases start with a lowercase letter |
||
| async function countDocumentEmbeds() { | ||
| return await browser.execute(() => { | ||
| return document.embeds?.length ?? 0; | ||
| }); | ||
| } | ||
|
|
||
| async function documentEmbedsSelfIdentity() { | ||
| return await browser.execute(() => { | ||
| return document.embeds === document.embeds; | ||
| }); | ||
| } | ||
|
|
||
| async function removeEl(selector: string) { | ||
| const el = await $(selector); | ||
| await browser.execute((element) => { | ||
| element.remove(); | ||
| }, el); | ||
| } | ||
|
|
||
| await injectRuffleAndWait(browser); | ||
| await playAndMonitor( | ||
| browser, | ||
| await browser.$("#test-container").$("ruffle-embed#emb1"), | ||
| ); | ||
| await playAndMonitor( | ||
| browser, | ||
| await browser.$("#test-container").$("ruffle-embed#emb2"), | ||
| ); | ||
| await playAndMonitor( | ||
| browser, | ||
| await browser.$("#test-container").$("ruffle-embed#emb3"), | ||
| ); | ||
|
Comment on lines
+30
to
+41
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are those needed? Even with autoplay disabled embeds should work, right? |
||
| const documentEmbedsIdentity = await documentEmbedsSelfIdentity(); | ||
| expect(documentEmbedsIdentity).to.equal(true); | ||
| const embeds1 = await countDocumentEmbeds(); | ||
| expect(embeds1).to.equal(3); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think you can inline |
||
| await removeEl("#emb1"); | ||
| const embeds2 = await countDocumentEmbeds(); | ||
| expect(embeds2).to.equal(2); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we dynamically add an embed at the end and check if the number went up? |
||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this to a variable?