Skip to content

Commit a65a65d

Browse files
committed
add tests for stripe's html and for property line-breaking
1 parent 1b4ff4f commit a65a65d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/render/src/shared/utils/pretty.spec.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ describe('lenientParse()', () => {
1616

1717
describe('pretty', () => {
1818
it('should prettify base doucment correctly', () => {
19-
const document = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><body style="background-color:#fff;"><h1>whatever</h1><input placeholder="hello world"/></body></html>`;
19+
const document =
20+
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><body style="background-color:#fff;"><h1>whatever</h1><input placeholder="hello world"/></body></html>';
2021
expect(pretty(document, { lineBreak: '\n' })).toMatchSnapshot();
2122
});
2223

23-
// it("should prettify Preview component's complex characters correctly", async () => {
24-
// const stripeHTML = await fs.readFile(
25-
// path.resolve(__dirname, './stripe-email.html'),
26-
// 'utf8',
27-
// );
28-
//
29-
// expect(await pretty(stripeHTML)).toMatchSnapshot();
30-
// });
31-
//
24+
it('should print properties per-line once they get too wide', () => {
25+
const document =
26+
'<div style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:#e6ebf1;margin:20px 0"></div>';
27+
expect(pretty(document, { lineBreak: '\n' })).toMatchSnapshot();
28+
});
29+
30+
it("should prettify Preview component's complex characters correctly", () => {
31+
expect(pretty(stripeHTML, { lineBreak: '\n' })).toMatchSnapshot();
32+
});
33+
3234
// test('if mso syntax does not wrap', async () => {
3335
// expect(
3436
// await pretty(

0 commit comments

Comments
 (0)