adds frontend
This commit is contained in:
26
test/archiver.test.mjs
Normal file
26
test/archiver.test.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { renderPage } from "../src/archiver.mjs";
|
||||
|
||||
test("renderPage serializes CSSOM-inserted style rules", async () => {
|
||||
const html = `<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style id="runtime-style"></style>
|
||||
<script>
|
||||
document
|
||||
.getElementById("runtime-style")
|
||||
.sheet
|
||||
.insertRule(".runtime-rule { color: rgb(1, 2, 3); }", 0);
|
||||
</script>
|
||||
</head>
|
||||
<body><div class="runtime-rule">Styled by CSSOM</div></body>
|
||||
</html>`;
|
||||
|
||||
const rendered = await renderPage(`data:text/html,${encodeURIComponent(html)}`, {
|
||||
userscriptDelay: 0
|
||||
});
|
||||
|
||||
assert.match(rendered, /<style id="runtime-style">[\s\S]*\.runtime-rule/);
|
||||
assert.match(rendered, /color:\s*rgb\(1,\s*2,\s*3\)/);
|
||||
});
|
||||
Reference in New Issue
Block a user