ruffle/web/packages/selfhosted/test/polyfill/remove_object/test.ts

33 lines
1007 B
TypeScript
Raw Normal View History

import { injectRuffleAndWait, openTest } from "../../utils.js";
import { expect, use } from "chai";
import chaiHtml from "chai-html";
import fs from "fs";
2020-05-23 09:43:22 +00:00
use(chaiHtml);
describe("Remove object", () => {
it("loads the test", async () => {
await openTest(browser, `polyfill/remove_object`);
2020-05-23 09:43:22 +00:00
});
it("polyfills with ruffle", async () => {
2023-05-30 20:24:43 +00:00
await injectRuffleAndWait(browser);
const actual = await browser.$("#test-container").getHTML(false);
const expected = fs.readFileSync(
`${import.meta.dirname}/expected.html`,
"utf8",
);
2020-05-23 09:43:22 +00:00
expect(actual).html.to.equal(expected);
});
it("deletes ruffle player by id", async () => {
await browser.execute(() => {
2020-05-23 09:43:22 +00:00
const obj = document.getElementById("foo");
obj?.remove();
2020-05-23 09:43:22 +00:00
});
const actual = await browser.$("#test-container").getHTML(false);
2020-05-23 09:43:22 +00:00
const expected = "";
expect(actual).html.to.equal(expected);
});
});