Skip to content

Commit cdfb6c8

Browse files
authored
fix(jsx-email,plugin-minify): bogusComment setting corrupting vml comments. fixes #271 (#279)
1 parent c1f3bf9 commit cdfb6c8

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`<Button> component > minifies outlook xml properly 1`] = `
4+
"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Transitional//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\"><head><table border=\\"0\\"cellpadding=\\"0\\"cellspacing=\\"0\\"role=\\"presentation\\"style=\\"border-collapse:collapse\\"width=\\"100%\\"><tr><td align=\\"left\\"><span><!--[if mso]>
5+
<v:roundrect href=\\"undefined\\" xmlns:v=\\"urn:schemas-microsoft-com:vml\\" xmlns:w=\\"urn:schemas-microsoft-com:office:word\\" style=\\"height:40px;v-text-anchor:middle;width:200px;\\" arcsize=\\"0%\\" strokeweight=\\"1px\\" fill=\\"false\\">
6+
<w:anchorlock/>
7+
<center style=\\"font-size:16px;\\">
8+
Test message
9+
</center></v:roundrect>
10+
<![endif]--></span><a style=\\"-webkit-text-size-adjust:none;border-radius:0;display:inline-block;font-size:16px;line-height:38px;max-width:200px;text-align:center;text-decoration:none;width:100%;mso-hide:all\\">Test message</a></table>"
11+
`;

packages/jsx-email/test/render/.snapshots/render.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,6 @@ exports[`render > renders the vercel demo template 2`] = `
787787
</html>"
788788
`;
789789
790-
exports[`render > renders with minifying 1`] = `"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Transitional//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\"><html dir=\\"ltr\\"lang=\\"en\\"xmlns:o=\\"urn:schemas-microsoft-com:office:office\\"xmlns:v=\\"urn:schemas-microsoft-com:vml\\"><meta charset=\\"utf8\\"><meta name=\\"viewport\\"content=\\"width=device-width,initial-scale=1\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\"content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><meta name=\\"viewport\\"content=\\"width=device-width,initial-scale=1\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\"content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><?[if mso]&#62<xml&#62<o:OfficeDocumentSettings&#62<o:AllowPNG&#62</o:AllowPNG&#62<o:PixelsPerInch&gt;96</o:PixelsPerInch&#62</o:OfficeDocumentSettings&#62</xml&#62<![endif]><body style=\\"background-color:#fff;font-family:HelveticaNeue,Helvetica,Arial,sans-serif\\"><div style=\\"table-layout:fixed;width:100%\\"><div style=\\"margin:0 auto;max-width:600px\\"><span><?[if mso]&#62<table align=\\"center\\" width=\\"600\\" style=\\"border-spacing: 0; width:600px;\\" role=\\"presentation\\"&#62<tr&#62<td&#62<![endif]></span><table align=\\"center\\"border=\\"0\\"cellpadding=\\"0\\"cellspacing=\\"0\\"role=\\"presentation\\"style=\\"max-width:600px;background-color:#fff;border:1px solid #eee;border-radius:5px;box-shadow:0 5px 10px rgba(20,50,70,.2);margin-top:20px;width:360px;margin:0 auto;padding:68px 0 130px\\"width=\\"100%\\"><tr style=\\"width:100%\\"><td align=\\"center\\"><img alt=\\"Plaid\\"height=\\"88\\"src=\\"https://jsx.email/assets/demo/plaid-logo.png\\"style=\\"border:none;display:block;outline:0;text-decoration:none;margin:0 auto\\"width=\\"212\\"><p style=\\"font-size:11px;line-height:16px;margin:16px 8px 8px 8px;color:#0a85ea;font-weight:700;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;height:16px;letter-spacing:0;text-transform:uppercase;text-align:center\\">Verify Your Identity<h1 style=\\"color:#000;display:inline-block;font-family:HelveticaNeue-Medium,Helvetica,Arial,sans-serif;font-size:20px;font-weight:500;line-height:24px;margin-bottom:0;margin-top:0;text-align:center\\">Enter the following code to finish linking Venmo.</h1><table align=\\"center\\"border=\\"0\\"cellpadding=\\"0\\"cellspacing=\\"0\\"role=\\"presentation\\"style=\\"background:rgba(0,0,0,.05);border-radius:4px;margin:16px auto 14px;vertical-align:middle;width:280px\\"width=\\"100%\\"><tr><td><p style=\\"font-size:32px;line-height:40px;margin:0 auto;color:#000;display:inline-block;font-family:HelveticaNeue-Bold;font-weight:700;letter-spacing:6px;padding-bottom:8px;padding-top:8px;width:100%;text-align:center\\"></table><p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Not expecting this email?<p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Contact <a href=\\"mailto:[email protected]\\"style=\\"color:#444;text-decoration:underline\\">[email protected]</a> if you did not request this code.</table><span><?[if mso]&#62</td&#62</tr&#62</table&#62<![endif]></span></div></div><p style=\\"font-size:12px;line-height:23px;margin:0;color:#000;font-weight:800;letter-spacing:0;margin-top:20px;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;text-align:center;text-transform:uppercase\\">Securely powered by Plaid."`;
790+
exports[`render > renders with minifying 1`] = `"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Transitional//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\"><html dir=\\"ltr\\"lang=\\"en\\"xmlns:o=\\"urn:schemas-microsoft-com:office:office\\"xmlns:v=\\"urn:schemas-microsoft-com:vml\\"><meta charset=\\"utf8\\"><meta name=\\"viewport\\"content=\\"width=device-width,initial-scale=1\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\"content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><meta name=\\"viewport\\"content=\\"width=device-width,initial-scale=1\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\"content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><!--[if mso]><xml><o:OfficeDocumentSettings><o:AllowPNG></o:AllowPNG><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--><body style=\\"background-color:#fff;font-family:HelveticaNeue,Helvetica,Arial,sans-serif\\"><div style=\\"table-layout:fixed;width:100%\\"><div style=\\"margin:0 auto;max-width:600px\\"><span><!--[if mso]><table align=\\"center\\" width=\\"600\\" style=\\"border-spacing: 0; width:600px;\\" role=\\"presentation\\"><tr><td><![endif]--></span><table align=\\"center\\"border=\\"0\\"cellpadding=\\"0\\"cellspacing=\\"0\\"role=\\"presentation\\"style=\\"max-width:600px;background-color:#fff;border:1px solid #eee;border-radius:5px;box-shadow:0 5px 10px rgba(20,50,70,.2);margin-top:20px;width:360px;margin:0 auto;padding:68px 0 130px\\"width=\\"100%\\"><tr style=\\"width:100%\\"><td align=\\"center\\"><img alt=\\"Plaid\\"height=\\"88\\"src=\\"https://jsx.email/assets/demo/plaid-logo.png\\"style=\\"border:none;display:block;outline:0;text-decoration:none;margin:0 auto\\"width=\\"212\\"><p style=\\"font-size:11px;line-height:16px;margin:16px 8px 8px 8px;color:#0a85ea;font-weight:700;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;height:16px;letter-spacing:0;text-transform:uppercase;text-align:center\\">Verify Your Identity<h1 style=\\"color:#000;display:inline-block;font-family:HelveticaNeue-Medium,Helvetica,Arial,sans-serif;font-size:20px;font-weight:500;line-height:24px;margin-bottom:0;margin-top:0;text-align:center\\">Enter the following code to finish linking Venmo.</h1><table align=\\"center\\"border=\\"0\\"cellpadding=\\"0\\"cellspacing=\\"0\\"role=\\"presentation\\"style=\\"background:rgba(0,0,0,.05);border-radius:4px;margin:16px auto 14px;vertical-align:middle;width:280px\\"width=\\"100%\\"><tr><td><p style=\\"font-size:32px;line-height:40px;margin:0 auto;color:#000;display:inline-block;font-family:HelveticaNeue-Bold;font-weight:700;letter-spacing:6px;padding-bottom:8px;padding-top:8px;width:100%;text-align:center\\"></table><p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Not expecting this email?<p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Contact <a href=\\"mailto:[email protected]\\"style=\\"color:#444;text-decoration:underline\\">[email protected]</a> if you did not request this code.</table><span><!--[if mso]></td></tr></table><![endif]--></span></div></div><p style=\\"font-size:12px;line-height:23px;margin:0;color:#000;font-weight:800;letter-spacing:0;margin-top:20px;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;text-align:center;text-transform:uppercase\\">Securely powered by Plaid."`;
791791
792792
exports[`render > renders without minifying 1`] = `"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Transitional//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\"><html lang=\\"en\\" dir=\\"ltr\\" xmlns:o=\\"urn:schemas-microsoft-com:office:office\\" xmlns:v=\\"urn:schemas-microsoft-com:vml\\"><head><meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=UTF-8\\"><meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1, user-scalable=yes\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\" content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1, user-scalable=yes\\"><meta name=\\"x-apple-disable-message-reformatting\\"><meta name=\\"format-detection\\" content=\\"telephone=no, date=no, address=no, email=no, url=no\\"><!--[if mso]><xml><o:OfficeDocumentSettings><o:AllowPNG></o:AllowPNG><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body style=\\"background-color:#ffffff;font-family:HelveticaNeue,Helvetica,Arial,sans-serif\\"><div style=\\"table-layout:fixed;width:100%\\"><div style=\\"margin:0 auto;max-width:600px\\"><span><!--[if mso]><table align=\\"center\\" width=\\"600\\" style=\\"border-spacing: 0; width:600px;\\" role=\\"presentation\\"><tr><td><![endif]--></span><table align=\\"center\\" width=\\"100%\\" role=\\"presentation\\" cellspacing=\\"0\\" cellpadding=\\"0\\" border=\\"0\\" style=\\"max-width:600px;background-color:#ffffff;border:1px solid #eee;border-radius:5px;box-shadow:0 5px 10px rgba(20,50,70,.2);margin-top:20px;width:360px;margin:0 auto;padding:68px 0 130px\\"><tbody><tr style=\\"width:100%\\"><td align=\\"center\\"><img alt=\\"Plaid\\" src=\\"https://jsx.email/assets/demo/plaid-logo.png\\" width=\\"212\\" height=\\"88\\" style=\\"border:none;display:block;outline:none;text-decoration:none;margin:0 auto\\"><p style=\\"font-size:11px;line-height:16px;margin:16px 8px 8px 8px;color:#0a85ea;font-weight:700;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;height:16px;letter-spacing:0;text-transform:uppercase;text-align:center\\">Verify Your Identity</p><h1 style=\\"color:#000;display:inline-block;font-family:HelveticaNeue-Medium,Helvetica,Arial,sans-serif;font-size:20px;font-weight:500;line-height:24px;margin-bottom:0;margin-top:0;text-align:center\\">Enter the following code to finish linking Venmo.</h1><table align=\\"center\\" width=\\"100%\\" style=\\"background:rgba(0,0,0,.05);border-radius:4px;margin:16px auto 14px;vertical-align:middle;width:280px\\" border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\" role=\\"presentation\\"><tbody><tr><td><p style=\\"font-size:32px;line-height:40px;margin:0 auto;color:#000;display:inline-block;font-family:HelveticaNeue-Bold;font-weight:700;letter-spacing:6px;padding-bottom:8px;padding-top:8px;width:100%;text-align:center\\"></p></td></tr></tbody></table><p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Not expecting this email?</p><p style=\\"font-size:15px;line-height:23px;margin:0;color:#444;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;letter-spacing:0;padding:0 40px;text-align:center\\">Contact <a href=\\"mailto:[email protected]\\" style=\\"color:#444;text-decoration:underline\\">[email protected]</a> if you did not request this code.</p></td></tr></tbody></table><span><!--[if mso]></td></tr></table><![endif]--></span></div></div><p style=\\"font-size:12px;line-height:23px;margin:0;color:#000;font-weight:800;letter-spacing:0;margin-top:20px;font-family:HelveticaNeue,Helvetica,Arial,sans-serif;text-align:center;text-transform:uppercase\\">Securely powered by Plaid.</p></body></html>"`;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// @ts-ignore
2+
import React from 'react';
3+
4+
import { render } from '../../src/renderer/render.js';
5+
import { Button } from '../../src/index.js';
6+
7+
describe('<Button> component', async () => {
8+
beforeEach(() => {
9+
vi.restoreAllMocks();
10+
vi.resetModules();
11+
});
12+
13+
it('minifies outlook xml properly', async () => {
14+
const html = await render(
15+
<Button width={200} height={40}>
16+
{'Test message'}
17+
</Button>,
18+
{ minify: true }
19+
);
20+
expect(html).toMatchSnapshot();
21+
});
22+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"noEmit": true,
4+
"types": ["vitest/globals"]
5+
},
6+
"extends": "../../../shared/tsconfig.base.json",
7+
"include": ["**/*.ts", "**/*.tsx"]
8+
}

packages/plugin-minify/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const importPlugins = async () => {
5151

5252
const settings = {
5353
allowParseErrors: true,
54-
bogusComments: true,
5554
characterReferences: {
5655
omitOptionalSemicolons: true,
5756
useShortestReferences: true

0 commit comments

Comments
 (0)