Skip to content

Commit 317576c

Browse files
test(html): cover a plain redundant type and a declined body
1 parent d7d3b8a commit 317576c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎test/HtmlSyntax.unittest.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,6 +4273,19 @@ describe("SourceProcessor — inline <script> whitespace", () => {
42734273
expect(minifyBody(type, " var a = 1 ")).toBe("var a = 1");
42744274
});
42754275

4276+
it("keeps the trim where a renderer declines the body", () => {
4277+
// The edges go before the offer, so declining costs them nothing.
4278+
const out = new SourceProcessor().process(
4279+
"<script> var a = 1 </script>",
4280+
{
4281+
mode: /** @type {"minify"} */ ("minify"),
4282+
collapseWhitespace: /** @type {"all"} */ ("all"),
4283+
renderEmbeddedSource: () => undefined
4284+
}
4285+
).code;
4286+
expect(out).toBe("<script>var a = 1</script>");
4287+
});
4288+
42764289
it("trims a JSON body the strip declines", () => {
42774290
// Embedded all the same: the edges are outside whatever it holds.
42784291
expect(minifyBody("application/ld+json", " {{ t }} ")).toBe("{{ t }}");
@@ -4373,6 +4386,9 @@ describe("SourceProcessor — inline <script> whitespace", () => {
43734386
mode: /** @type {"minify"} */ ("minify"),
43744387
removeRedundantAttributes: /** @type {"smart"} */ ("smart")
43754388
}).code;
4389+
expect(minify('<script type="text/javascript">var a = 1</script>')).toBe(
4390+
"<script>var a = 1</script>"
4391+
);
43764392
expect(
43774393
minify('<script type="text&#47;javascript">var a = 1</script>')
43784394
).toBe("<script>var a = 1</script>");

0 commit comments

Comments
 (0)