@@ -9,38 +9,38 @@ describe("Markdown component", function () {
9
9
const getConfigs = ( ) => ( { useUnsafeMarkdown : true } )
10
10
const str = `<span class="method" style="border-width: 1px" data-attr="value">ONE</span>`
11
11
const el = render ( < Markdown source = { str } getConfigs = { getConfigs } /> )
12
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p><span data-attr="value" style="border-width: 1px" class="method">ONE</span></p>\n</div>` )
12
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p><span data-attr="value" style="border-width: 1px" class="method">ONE</span></p>\n</div>` )
13
13
} )
14
14
15
15
it ( "strips class, style and data-* attribs from elements" , function ( ) {
16
16
const getConfigs = ( ) => ( { useUnsafeMarkdown : false } )
17
17
const str = `<span class="method" style="border-width: 1px" data-attr="value">ONE</span>`
18
18
const el = render ( < Markdown source = { str } getConfigs = { getConfigs } /> )
19
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p><span>ONE</span></p>\n</div>` )
19
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p><span>ONE</span></p>\n</div>` )
20
20
} )
21
21
22
22
it ( "allows td elements with colspan attrib" , function ( ) {
23
23
const str = `<table><tr><td>ABC</td></tr></table>`
24
24
const el = render ( < Markdown source = { str } /> )
25
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><table><tbody><tr><td>ABC</td></tr></tbody></table></div>` )
25
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><table><tbody><tr><td>ABC</td></tr></tbody></table></div>` )
26
26
} )
27
27
28
28
it ( "allows image elements" , function ( ) {
29
29
const str = ``
30
30
const el = render ( < Markdown source = { str } /> )
31
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p><img title="Image title" alt="Image alt text" src="http://image.source"></p>\n</div>` )
31
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p><img title="Image title" alt="Image alt text" src="http://image.source"></p>\n</div>` )
32
32
} )
33
33
34
34
it ( "allows image elements with https scheme" , function ( ) {
35
35
const str = ``
36
36
const el = render ( < Markdown source = { str } /> )
37
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p><img title="Image title" alt="Image alt text" src="https://image.source"></p>\n</div>` )
37
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p><img title="Image title" alt="Image alt text" src="https://image.source"></p>\n</div>` )
38
38
} )
39
39
40
40
it ( "allows image elements with data scheme" , function ( ) {
41
41
const str = `<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==">`
42
42
const el = render ( < Markdown source = { str } /> )
43
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p>` + str + `</p>\n</div>` )
43
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p>` + str + `</p>\n</div>` )
44
44
} )
45
45
46
46
it ( "allows heading elements" , function ( ) {
@@ -52,13 +52,13 @@ describe("Markdown component", function () {
52
52
##### h5
53
53
###### h6`
54
54
const el = render ( < Markdown source = { str } /> )
55
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6>\n</div>` )
55
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6>\n</div>` )
56
56
} )
57
57
58
58
it ( "allows links" , function ( ) {
59
59
const str = `[Link](https://example.com/)`
60
60
const el = render ( < Markdown source = { str } /> )
61
- expect ( el . html ( ) ) . toEqual ( `<div class="markdown"><p><a rel="noopener noreferrer" target="_blank" href="https://example.com/">Link</a></p>\n</div>` )
61
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="markdown"><p><a rel="noopener noreferrer" target="_blank" href="https://example.com/">Link</a></p>\n</div>` )
62
62
} )
63
63
} )
64
64
@@ -67,32 +67,32 @@ describe("Markdown component", function () {
67
67
const getConfigs = ( ) => ( { useUnsafeMarkdown : true } )
68
68
const str = `<span class="method" style="border-width: 1px" data-attr="value">ONE</span>`
69
69
const el = render ( < OAS3Markdown source = { str } getConfigs = { getConfigs } /> )
70
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><p><span data-attr="value" style="border-width: 1px" class="method">ONE</span></p></div>` )
70
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><p><span data-attr="value" style="border-width: 1px" class="method">ONE</span></p></div>` )
71
71
} )
72
72
73
73
it ( "strips class, style and data-* attribs from elements" , function ( ) {
74
74
const getConfigs = ( ) => ( { useUnsafeMarkdown : false } )
75
75
const str = `<span class="method" style="border-width: 1px" data-attr="value">ONE</span>`
76
76
const el = render ( < OAS3Markdown source = { str } getConfigs = { getConfigs } /> )
77
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><p><span>ONE</span></p></div>` )
77
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><p><span>ONE</span></p></div>` )
78
78
} )
79
79
80
80
it ( "allows image elements" , function ( ) {
81
81
const str = ``
82
82
const el = render ( < OAS3Markdown source = { str } /> )
83
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="http://image.source"></p></div>` )
83
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="http://image.source"></p></div>` )
84
84
} )
85
85
86
86
it ( "allows image elements with https scheme" , function ( ) {
87
87
const str = ``
88
88
const el = render ( < OAS3Markdown source = { str } /> )
89
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="https://image.source"></p></div>` )
89
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="https://image.source"></p></div>` )
90
90
} )
91
91
92
92
it ( "allows image elements with data scheme" , function ( ) {
93
93
const str = `<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==">`
94
94
const el = render ( < OAS3Markdown source = { str } /> )
95
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><p>` + str + `</p></div>` )
95
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><p>` + str + `</p></div>` )
96
96
} )
97
97
98
98
it ( "allows heading elements" , function ( ) {
@@ -104,7 +104,7 @@ describe("Markdown component", function () {
104
104
##### h5
105
105
###### h6`
106
106
const el = render ( < OAS3Markdown source = { str } /> )
107
- expect ( el . html ( ) ) . toEqual ( `<div class="renderedMarkdown"><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6></div>` )
107
+ expect ( el . prop ( "outerHTML" ) ) . toEqual ( `<div class="renderedMarkdown"><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6></div>` )
108
108
} )
109
109
} )
110
110
} )
0 commit comments