Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST (common): add more tests to common components
- Loading branch information
Showing
5 changed files
with
109 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Asciidoc from 'components/common/AsciiDoc'; | ||
|
||
const setup = (props) => shallow(<Asciidoc { ...props }/>); | ||
const text = `bold *constrained* & **un**constrained | ||
italic _constrained_ & __un__constrained | ||
bold italic *_constrained_* & **__un__**constrained`; | ||
|
||
describe('COMPONENTS - <Asciidoc>', () => { | ||
test('render Asciidoc', () => { | ||
const component = setup({ text }); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
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,37 @@ | ||
import { Markdown } from 'components/common/Markdown'; | ||
|
||
const setup = (props) => shallow(<Markdown { ...props }/>); | ||
const text = '#hello' + | ||
'\n' + | ||
'Paragraph **with** _stuff_' + | ||
'\n' + | ||
'```' + '\n' + | ||
'code' + '\n' + | ||
'```' + '\n' + | ||
'\n' + | ||
'> quote' + | ||
'\n' + | ||
'[link](https://wwww.gistoapp.com)'; | ||
|
||
const textWithEmoji = `${text} :100:`; | ||
|
||
describe('COMPONENTS - <Markdown>', () => { | ||
test('render Markdown', () => { | ||
const component = setup({ | ||
text | ||
}); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('render Markdown with emoji', () => { | ||
const component = setup({ | ||
text: textWithEmoji, | ||
emoji: ({ | ||
100: 'https://dummy-emoji.url' | ||
}) | ||
}); | ||
|
||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
__tests__/components/common/__snapshots__/AsciiDoc.spec.js.snap
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,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`COMPONENTS - <Asciidoc> render Asciidoc 1`] = ` | ||
<div | ||
className="markdown-body undefined" | ||
dangerouslySetInnerHTML={ | ||
Object { | ||
"__html": "<div class=\\"paragraph\\"> | ||
<p>bold <strong>constrained</strong> & <strong>un</strong>constrained</p> | ||
</div> | ||
<div class=\\"paragraph\\"> | ||
<p>italic <em>constrained</em> & <em>un</em>constrained</p> | ||
</div> | ||
<div class=\\"paragraph\\"> | ||
<p>bold italic <strong><em>constrained</em></strong> & <strong><em>un</em></strong>constrained</p> | ||
</div>", | ||
} | ||
} | ||
/> | ||
`; |
35 changes: 35 additions & 0 deletions
35
__tests__/components/common/__snapshots__/Markdown.spec.js.snap
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,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`COMPONENTS - <Markdown> render Markdown 1`] = ` | ||
<div | ||
className="markdown-body undefined" | ||
dangerouslySetInnerHTML={ | ||
Object { | ||
"__html": "<p>#hello | ||
Paragraph <strong>with</strong> <em>stuff</em></p> | ||
<pre><code><span class=\\"hljs-keyword\\">code</span></code></pre><blockquote> | ||
<p>quote | ||
<a href=\\"https://wwww.gistoapp.com\\">link</a></p> | ||
</blockquote> | ||
", | ||
} | ||
} | ||
/> | ||
`; | ||
exports[`COMPONENTS - <Markdown> render Markdown with emoji 1`] = ` | ||
<div | ||
className="markdown-body undefined" | ||
dangerouslySetInnerHTML={ | ||
Object { | ||
"__html": "<p>#hello | ||
Paragraph <strong>with</strong> <em>stuff</em></p> | ||
<pre><code><span class=\\"hljs-keyword\\">code</span></code></pre><blockquote> | ||
<p>quote | ||
<a href=\\"https://wwww.gistoapp.com\\">link</a> <img src=\\"https://dummy-emoji.url\\" style=\\"width: 18px;vertical-align: middle;background: transparent;\\"/></p> | ||
</blockquote> | ||
", | ||
} | ||
} | ||
/> | ||
`; |
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