Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/img/src/img.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('<Img> component', () => {
<Img alt="Cat" height="300" src="cat.jpg" width="300" />,
);
expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="cat.jpg"/><!--$--><img alt="Cat" height="300" src="cat.jpg" style="display:block;outline:none;border:none;text-decoration:none" width="300"/><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><img alt="Cat" fetchPriority="low" height="300" src="cat.jpg" style="display:block;outline:none;border:none;text-decoration:none" width="300"/><!--/$-->"`,
);
});
});
4 changes: 4 additions & 0 deletions packages/img/src/img.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const Img = React.forwardRef<HTMLImageElement, ImgProps>(
<img
{...props}
alt={alt}
// Setting fetchPriority to "low" prevents React 19's SSR from
// auto-injecting <link rel="preload"> tags for every image, which are
// unnecessary noise in email HTML. Email clients ignore this attribute.
fetchPriority="low"
height={height}
ref={ref}
src={src}
Expand Down
8 changes: 4 additions & 4 deletions packages/preview-server/src/utils/get-email-component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ describe('getEmailComponent()', () => {
"<!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">
<head>
<link rel="preload" as="image" href="/static/vercel-logo.png" />
<link rel="preload" as="image" href="/static/vercel-user.png" />
<link rel="preload" as="image" href="/static/vercel-arrow.png" />
<link rel="preload" as="image" href="/static/vercel-team.png" />
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta name="x-apple-disable-message-reformatting" />
<!--$-->
Expand Down Expand Up @@ -81,6 +77,7 @@ describe('getEmailComponent()', () => {
<td>
<img
alt="Vercel Logo"
fetchpriority="low"
height="37"
src="/static/vercel-logo.png"
style="display:block;outline:none;border:none;text-decoration:none;margin-right:auto;margin-left:auto;margin-bottom:0;margin-top:0"
Expand Down Expand Up @@ -132,6 +129,7 @@ describe('getEmailComponent()', () => {
data-id="__react-email-column">
<img
alt="alanturing&#x27;s profile picture"
fetchpriority="low"
height="64"
src="/static/vercel-user.png"
style="display:block;outline:none;border:none;text-decoration:none;border-radius:9999px"
Expand All @@ -142,6 +140,7 @@ describe('getEmailComponent()', () => {
data-id="__react-email-column">
<img
alt="Arrow indicating invitation"
fetchpriority="low"
height="9"
src="/static/vercel-arrow.png"
style="display:block;outline:none;border:none;text-decoration:none"
Expand All @@ -152,6 +151,7 @@ describe('getEmailComponent()', () => {
data-id="__react-email-column">
<img
alt="Enigma team logo"
fetchpriority="low"
height="64"
src="/static/vercel-team.png"
style="display:block;outline:none;border:none;text-decoration:none;border-radius:9999px"
Expand Down
6 changes: 4 additions & 2 deletions packages/react-email/src/commands/testing/export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ test('email export', { retry: 3 }, async () => {
"<!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">
<head>
<link rel="preload" as="image" href="/static/vercel-logo.png" />
<link rel="preload" as="image" href="/static/vercel-arrow.png" />
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta name="x-apple-disable-message-reformatting" />
<!--$-->
Expand Down Expand Up @@ -71,6 +69,7 @@ test('email export', { retry: 3 }, async () => {
<td>
<img
alt="Vercel Logo"
fetchpriority="low"
height="37"
src="/static/vercel-logo.png"
style="display:block;outline:none;border:none;text-decoration:none;margin-right:auto;margin-left:auto;margin-bottom:0;margin-top:0"
Expand Down Expand Up @@ -121,6 +120,7 @@ test('email export', { retry: 3 }, async () => {
data-id="__react-email-column">
<img
alt="undefined&#x27;s profile picture"
fetchpriority="low"
height="64"
style="display:block;outline:none;border:none;text-decoration:none;border-radius:9999px"
width="64" />
Expand All @@ -130,6 +130,7 @@ test('email export', { retry: 3 }, async () => {
data-id="__react-email-column">
<img
alt="Arrow indicating invitation"
fetchpriority="low"
height="9"
src="/static/vercel-arrow.png"
style="display:block;outline:none;border:none;text-decoration:none"
Expand All @@ -140,6 +141,7 @@ test('email export', { retry: 3 }, async () => {
data-id="__react-email-column">
<img
alt="undefined team logo"
fetchpriority="low"
height="64"
style="display:block;outline:none;border:none;text-decoration:none;border-radius:9999px"
width="64" />
Expand Down
4 changes: 2 additions & 2 deletions packages/render/src/browser/render-web.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('render on the browser environment', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down Expand Up @@ -108,7 +108,7 @@ describe('render on the browser environment', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/render/src/edge/render.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('render on the edge', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down Expand Up @@ -108,7 +108,7 @@ describe('render on the edge', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down
6 changes: 3 additions & 3 deletions packages/render/src/node/render-edge.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('render on the edge', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);

vi.resetAllMocks();
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('render on the edge', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down Expand Up @@ -141,7 +141,7 @@ describe('render on the edge', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/render/src/node/render-node.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('render on node environments', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);

vi.resetAllMocks();
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('render on node environments', () => {
const actualOutput = await render(<Template firstName="Jim" />);

expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><link rel="preload" as="image" href="img/test.png"/><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><h1>Welcome, <!-- -->Jim<!-- -->!</h1><img alt="test" fetchPriority="low" src="img/test.png"/><p>Thanks for trying our product. We&#x27;re thrilled to have you on board!</p><!--/$-->"`,
);
});

Expand Down
1 change: 1 addition & 0 deletions packages/render/src/shared/utils/pretty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'utf8',
);

expect(await pretty(stripeHTML)).toMatchInlineSnapshot(`

Check failure on line 12 in packages/render/src/shared/utils/pretty.spec.ts

View workflow job for this annotation

GitHub Actions / tests

src/shared/utils/pretty.spec.ts > pretty > prettifies Preview component's complex characters correctly

Error: Snapshot `pretty > prettifies Preview component's complex characters correctly 1` mismatched - Expected + Received @@ -36,11 +36,10 @@ <tbody> <tr> <td> <img alt="Stripe" - fetchpriority="low" height="21" src="/static/stripe-logo.png" style="display:block;outline:none;border:none;text-decoration:none" width="49" /> <hr ❯ src/shared/utils/pretty.spec.ts:12:38
"<!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">
Expand Down Expand Up @@ -50,6 +50,7 @@
<td>
<img
alt="Stripe"
fetchpriority="low"
height="21"
src="/static/stripe-logo.png"
style="display:block;outline:none;border:none;text-decoration:none"
Expand Down
2 changes: 1 addition & 1 deletion packages/render/src/shared/utils/testing/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface TemplateProps {
export const Template: React.FC<Readonly<TemplateProps>> = ({ firstName }) => (
<>
<h1>Welcome, {firstName}!</h1>
<img alt="test" src="img/test.png" />
<img alt="test" fetchPriority="low" src="img/test.png" />
<p>Thanks for trying our product. We're thrilled to have you on board!</p>
</>
);
Loading