forked from remarkjs/react-markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-markdown-types-test.tsx
More file actions
50 lines (46 loc) · 1.66 KB
/
react-markdown-types-test.tsx
File metadata and controls
50 lines (46 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as React from 'react'
import * as ReactDom from 'react-dom'
import * as ReactMarkdown from 'react-markdown'
import * as ReactMarkdownWitHtml from 'react-markdown/with-html'
/* must have children or source, but not both and not neither */
let test = <ReactMarkdown># header</ReactMarkdown>
test = <ReactMarkdown children="# header" />
test = <ReactMarkdown source="# header"></ReactMarkdown>
// $ExpectError
test = <ReactMarkdown />
// $ExpectError
test = <ReactMarkdown source="# header"># header</ReactMarkdown>
// $ExpectError
test = <ReactMarkdown source="# header" children="# header" />
/* should support allowedTypes or disallowedTypes, but not both */
test = <ReactMarkdown allowedTypes={['heading']}># header</ReactMarkdown>
test = <ReactMarkdown disallowedTypes={['heading']}># header</ReactMarkdown>
test = (
<ReactMarkdown disallowedTypes={['heading']} unwrapDisallowed>
# header
</ReactMarkdown>
)
test = (
// $ExpectError
<ReactMarkdown allowedTypes={['heading']} disallowedTypes={['heading']}>
# header
</ReactMarkdown>
)
test = (
// $ExpectError
<ReactMarkdown allowedTypes={['heading']} unwrapDisallowed>
# header
</ReactMarkdown>
)
/* should support skipHtml or escapeHtml, but not both */
test = <ReactMarkdown escapeHtml># header</ReactMarkdown>
test = <ReactMarkdown skipHtml># header</ReactMarkdown>
test = <ReactMarkdown allowDangerousHtml># header</ReactMarkdown>
test = (
// $ExpectError
<ReactMarkdown escapeHtml skipHtml allowDangerousHtml>
# header
</ReactMarkdown>
)
ReactDom.render(<ReactMarkdown># header</ReactMarkdown>, document.body)
ReactDom.render(<ReactMarkdownWitHtml># header</ReactMarkdownWitHtml>, document.body)