File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,26 @@ describe("CodeView", () => {
1111 afterEach ( ( ) => {
1212 cleanup ( ) ;
1313 } ) ;
14- test ( "correctly renders component content" , ( ) => {
14+ test ( "correctly renders simple content" , ( ) => {
1515 render ( < CodeView content = { "Hello World" } > </ CodeView > ) ;
1616 const wrapper = createWrapper ( ) ! . findCodeView ( ) ;
1717 expect ( wrapper ! . findContent ( ) [ 0 ] . getElement ( ) ) . toHaveTextContent ( "Hello World" ) ;
1818 } ) ;
1919
20+ test ( "correctly renders multi line content" , ( ) => {
21+ const content = `# Hello World\n\nThis is a markdown example.` ;
22+
23+ render ( < CodeView content = { content } > </ CodeView > ) ;
24+ const wrapper = createWrapper ( ) ! . findCodeView ( ) ;
25+ const contentElements = wrapper ! . findContent ( ) ;
26+ expect ( contentElements . length ) . toEqual ( 3 ) ;
27+ const renderedContent = contentElements
28+ . map ( ( element ) => element . getElement ( ) . textContent )
29+ . join ( "" )
30+ . trim ( ) ;
31+ expect ( renderedContent ) . toBe ( content ) ;
32+ } ) ;
33+
2034 test ( "correctly renders copy button slot" , ( ) => {
2135 render ( < CodeView content = { "Hello World" } actions = { < button > Copy</ button > } > </ CodeView > ) ;
2236 const wrapper = createWrapper ( ) ! . findCodeView ( ) ;
You can’t perform that action at this time.
0 commit comments