Skip to content

Commit 1916583

Browse files
committed
Add passing font-face with a data URL parsing test
Closes #743.
1 parent fc2a337 commit 1916583

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/api/from-outside.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,23 @@ describe("Test cases only possible to test from the outside", () => {
7474
const { window } = new JSDOM();
7575
assert.equal(window.document.currentScript, null);
7676
});
77+
78+
it("should process data: URLs in stylesheets even with external resources disabled (GH-743)", () => {
79+
const html = `
80+
<html><head>
81+
<style id="test-style">
82+
@font-face {
83+
font-family: "testfont";
84+
src: url(data:font/opentype;base64,AAEAAAABAAgAAAE=);
85+
}
86+
</style>
87+
</head><body></body></html>
88+
`;
89+
const { window } = new JSDOM(html);
90+
const { sheet } = window.document.getElementById("test-style");
91+
92+
assert.equal(sheet.cssRules.length, 1, "Should contain one CSS rule");
93+
const [fontFaceRule] = sheet.cssRules;
94+
assert.equal(fontFaceRule.type, window.CSSRule.FONT_FACE_RULE, "Rule should be a CSSFontFaceRule");
95+
});
7796
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy