generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! feat: add PDF component library
- Loading branch information
Showing
30 changed files
with
410 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { Article, Paragraph } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Article', () => { | ||
it('renders a <Art> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-article', | ||
render: () => ( | ||
<Article> | ||
<Paragraph>The quick brown fox jumps over the lazy dog</Paragraph> | ||
</Article> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('3a94e1e570c85d3c0d1c35589b65a6f1a690e8c581bed5a217d4713abc2d1dac'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { Blockquote, Paragraph } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Blockquote', () => { | ||
it('renders a <BlockQuote> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-blockquote', | ||
render: () => ( | ||
<Blockquote> | ||
<Paragraph>The quick brown fox jumps over the lazy dog.</Paragraph> | ||
</Blockquote> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('1565b0f7dd9ae4121654f76836cba952321e1d3110c7a910f2563d18a664eda8'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { Checkbox } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Checkbox', () => { | ||
it('renders a <Form> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-checkbox', | ||
render: () => <Checkbox />, | ||
}); | ||
|
||
expect(sha256).toBe('16860207ce8377c3b11bd31d676efba22d10f8eedacdf9098b702c2743fc512b'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { Code, Paragraph } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Code', () => { | ||
it('renders a <Code> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-code', | ||
render: () => ( | ||
<Paragraph> | ||
Use <Code>{'/* Hello world */'}</Code> to create a code comment. | ||
</Paragraph> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('f8104c20620bcf4c4e9a63f83c88d32841fef9f6ec481fb3de238d97997d134a'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { CodeBlock } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Code block', () => { | ||
it('renders a <Code> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-code-block', | ||
render: () => ( | ||
<CodeBlock>{`<!DOCTYPE html> | ||
<html lang="nl" dir="ltr"> | ||
<head> | ||
<title>NL Design System</title> | ||
<meta charset="utf-8"/> | ||
</head> | ||
<body> | ||
<h1>NL Design System</h1> | ||
</body> | ||
</html>`}</CodeBlock> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('46986780cbaeba8d2b585dc2d244f68a273121c8e831f1dba10912c968cfc0a8'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-env jest */ | ||
|
||
import { beforeAll, describe, expect, it } from '@jest/globals'; | ||
import { DataList, DataListItem, DataListKey, DataListValue } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Data list', () => { | ||
let sha256: string; | ||
|
||
beforeAll(async () => { | ||
({ sha256 } = await renderPdf({ | ||
id: 'pdf-data-list', | ||
render: () => ( | ||
<DataList> | ||
<DataListItem> | ||
<DataListKey>Pangram</DataListKey> | ||
<DataListValue>The quick brown fox jumps over the lazy dog</DataListValue> | ||
</DataListItem> | ||
</DataList> | ||
), | ||
})); | ||
}); | ||
|
||
it('renders a <L> tag', async () => { | ||
expect(sha256).toBe('1ef37478b0c027f45c557c94ca9c4d237860baf121f02d482e45b85c43348134'); | ||
}); | ||
|
||
describe('list item', () => { | ||
it('renders a <LI> tag', async () => { | ||
expect(sha256).toBe('1ef37478b0c027f45c557c94ca9c4d237860baf121f02d482e45b85c43348134'); | ||
}); | ||
|
||
it('renders a <Lbl> tag with the key', async () => { | ||
expect(sha256).toBe('1ef37478b0c027f45c557c94ca9c4d237860baf121f02d482e45b85c43348134'); | ||
}); | ||
|
||
it('renders a <LBody> tag with the value', async () => { | ||
expect(sha256).toBe('1ef37478b0c027f45c557c94ca9c4d237860baf121f02d482e45b85c43348134'); | ||
}); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
packages/component-library-pdf/src/FormFieldTextbox.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { FormFieldTextbox } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Form field with textbox', () => { | ||
it('renders a <Form> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-form-field-textbox', | ||
render: () => ( | ||
<FormFieldTextbox | ||
label="Postcode" | ||
description="Nederlandse postcode met 4 cijfers en 2 letters, bijvoorbeeld: 1234 AB." | ||
></FormFieldTextbox> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('d79ea42074650594beb4266345e09cabeb9a437ed13d66ac6f40527b715ec62b'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { FormLabel } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Form label', () => { | ||
it.skip('renders a <Lbl> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-form-label', | ||
render: () => <FormLabel>Name</FormLabel>, | ||
}); | ||
|
||
expect(sha256).toBe(''); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-env jest */ | ||
|
||
import { beforeAll, describe, expect, it } from '@jest/globals'; | ||
import { Paragraph } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Language span', () => { | ||
let sha256: string; | ||
|
||
beforeAll(async () => { | ||
({ sha256 } = await renderPdf({ | ||
id: 'pdf-span-lang', | ||
render: () => ( | ||
<Paragraph> | ||
Learn about <span lang="fr">joi de vivre</span>, an essential foreign phrase! | ||
</Paragraph> | ||
), | ||
})); | ||
}); | ||
|
||
it('renders a <Span> tag', async () => { | ||
expect(sha256).toBe('99db074fa02bc374efb1b74f388c93627100b0048e04dd986e003ab0ae88ea92'); | ||
}); | ||
|
||
it('renders a <Span> tag with the language set to French', async () => { | ||
expect(sha256).toBe('99db074fa02bc374efb1b74f388c93627100b0048e04dd986e003ab0ae88ea92'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { Link, Paragraph } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Link', () => { | ||
it('renders a <Link> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-link', | ||
render: () => ( | ||
<Paragraph> | ||
Go to <Link href="https://example.com/">example.com</Link>. | ||
</Paragraph> | ||
), | ||
}); | ||
|
||
expect(sha256).toBe('cfb53b1c5cdc2d5efc4b2cc2c933bfb8ef8d9fee0ec9ce7c2897f080189c9369'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
/* eslint-env jest */ | ||
|
||
import { describe, expect, it } from '@jest/globals'; | ||
import { beforeAll, describe, expect, it } from '@jest/globals'; | ||
import { OrderedList, OrderedListItem } from '@utrecht/component-library-react'; | ||
import React from 'react'; | ||
import { renderPdf } from './lib'; | ||
|
||
describe('Ordered list', () => { | ||
it('renders a <L> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
let sha256: string; | ||
|
||
beforeAll(async () => { | ||
({ sha256 } = await renderPdf({ | ||
id: 'pdf-ordered-list', | ||
render: () => ( | ||
<OrderedList> | ||
<OrderedListItem>The quick brown fox jumps over the lazy dog</OrderedListItem> | ||
</OrderedList> | ||
), | ||
}); | ||
})); | ||
}); | ||
|
||
expect(sha256).toBe('07fc6915a511ebf3fe9116a57bf6b5fc1bb3c597402a54a9c4a6f328453a6312'); | ||
it('renders a <L> tag', async () => { | ||
expect(sha256).toBe('051ffdb077ac93f772bd55f208bcf86a9c18d8c80da2e17ebba37665d7e1bdf6'); | ||
}); | ||
|
||
describe('list item', () => { | ||
it('renders a <LI> tag', async () => { | ||
const { sha256 } = await renderPdf({ | ||
id: 'pdf-ordered-list-item', | ||
render: () => ( | ||
<OrderedList> | ||
<OrderedListItem>The quick brown fox jumps over the lazy dog</OrderedListItem> | ||
</OrderedList> | ||
), | ||
}); | ||
expect(sha256).toBe('051ffdb077ac93f772bd55f208bcf86a9c18d8c80da2e17ebba37665d7e1bdf6'); | ||
}); | ||
|
||
it('renders a <Lbl> tag with list item counter', async () => { | ||
expect(sha256).toBe('051ffdb077ac93f772bd55f208bcf86a9c18d8c80da2e17ebba37665d7e1bdf6'); | ||
}); | ||
|
||
expect(sha256).toBe('61b4a7f5c904a9fc98cecf5da39fa9dde37ada56d9a1a3fbda46c1a275fdd8e2'); | ||
it('renders a <LBody> tag with the text content', async () => { | ||
expect(sha256).toBe('051ffdb077ac93f772bd55f208bcf86a9c18d8c80da2e17ebba37665d7e1bdf6'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.