@@ -91,18 +91,18 @@ describe('Utils', () => {
9191 it ( 'should verify that for html strings without any issues, proper object representation is created without any value missing' , ( ) => {
9292 const h1HeadingString = '<h1 id="main-heading">THIS IS A HEADING</h1>' ;
9393 const h1Object = Utils . renderContent ( h1HeadingString ) ;
94- expect ( h1Object . type ) . toEqual ( 'h1' ) ;
95- expect ( h1Object . props . id ) . toEqual ( 'main-heading' ) ;
96-
97- expect ( h1Object . props . children ) . toEqual ( 'THIS IS A HEADING' ) ;
94+ expect ( h1Object . type ) . toEqual ( 'span' ) ;
95+ expect ( h1Object . props . dangerouslySetInnerHTML . __html ) . toContain ( 'THIS IS A HEADING' ) ;
96+ expect ( h1Object . props . dangerouslySetInnerHTML . __html ) . toContain ( 'id="main-heading"' ) ;
9897 } ) ;
9998
10099 it ( 'should verify that for html strings with vulnerable code, it gets sanitized in object representation' , ( ) => {
101100 const imageHTMLString = '<img src=img.jpg onerror=alert(1)>' ;
102101 const imageObject = Utils . renderContent ( imageHTMLString ) ;
103- expect ( imageObject . type ) . toEqual ( 'img' ) ;
104- expect ( imageObject . props . src ) . toEqual ( 'img.jpg' ) ;
105- expect ( imageObject . props . onError ) . toBe ( undefined ) ;
102+ expect ( imageObject . type ) . toEqual ( 'span' ) ;
103+ expect ( imageObject . props . dangerouslySetInnerHTML . __html ) . toContain ( 'img.jpg' ) ;
104+ expect ( imageObject . props . dangerouslySetInnerHTML . __html ) . not . toContain ( 'onerror' ) ;
105+ expect ( imageObject . props . dangerouslySetInnerHTML . __html ) . not . toContain ( 'alert' ) ;
106106 } ) ;
107107
108108 it ( 'should apply attributes to React elements' , ( ) => {
0 commit comments