Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Dec 16, 2023
1 parent fd4b2be commit 6389ddb
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 14 deletions.
2 changes: 2 additions & 0 deletions packages/jsx-email/src/components/button/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

import type { BaseProps, JsxEmailComponent } from '../../types';

import { parsePadding } from './padding';

type RootProps = BaseProps<'a'>;
Expand Down
2 changes: 2 additions & 0 deletions packages/jsx-email/test/.snapshots/hr.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`<Hr> component > disables the default styles 1`] = `"<hr data-id=\\"jsx-email/hr\\" style=\\"\\"/>"`;
exports[`<Hr> component > renders correctly 1`] = `"<hr data-id=\\"jsx-email/hr\\" style=\\"border:none;border-top:1px solid #eaeaea;width:100%\\"/>"`;
2 changes: 1 addition & 1 deletion packages/jsx-email/test/.snapshots/link.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`<Link> component > renders correctly 1`] = `"<a href=\\"https://example.com\\" data-id=\\"jsx-email/link\\" target=\\"_blank\\" style=\\"color:#067df7;text-decoration:none\\">Example</a>"`;
exports[`<Link> component > renders correctly 1`] = `"<a href=\\"https://example.com\\" data-id=\\"jsx-email/link\\" style=\\"color:#067df7;text-decoration:none\\">Example</a>"`;
2 changes: 2 additions & 0 deletions packages/jsx-email/test/.snapshots/text.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`<Text> component > disables the default styles 1`] = `"<p data-id=\\"jsx-email/text\\" style=\\"\\">Test message</p>"`;
exports[`<Text> component > renders correctly 1`] = `"<p data-id=\\"jsx-email/text\\" style=\\"font-size:14px;line-height:24px;margin:16px 0\\">Lorem ipsum</p>"`;
5 changes: 5 additions & 0 deletions packages/jsx-email/test/hr.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ describe('<Hr> component', () => {
const actualOutput = await jsxToString(<Hr />);
expect(actualOutput).toMatchSnapshot();
});

it('disables the default styles', async () => {
const actualOutput = await jsxToString(<Hr disableDefaultStyle={true} />);
expect(actualOutput).toMatchSnapshot();
});
});
6 changes: 5 additions & 1 deletion packages/jsx-email/test/link.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ describe('<Link> component', async () => {
});

it('opens in a new tab', async () => {
const html = await jsxToString(<Link href="https://example.com">Test</Link>);
const html = await jsxToString(
<Link href="https://example.com" target="_blank">
Test
</Link>
);
expect(html).toContain(`target="_blank"`);
});

Expand Down
24 changes: 12 additions & 12 deletions packages/jsx-email/test/render/.snapshots/render.test.tsx.snap

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions packages/jsx-email/test/text.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ describe('<Text> component', async () => {
const actualOutput = await jsxToString(<Text>Lorem ipsum</Text>);
expect(actualOutput).toMatchSnapshot();
});

it('disables the default styles', async () => {
const testMessage = 'Test message';
const html = await jsxToString(<Text disableDefaultStyle={true}>{testMessage}</Text>);
expect(html).toMatchSnapshot();
});
});

0 comments on commit 6389ddb

Please sign in to comment.