@@ -73,6 +73,32 @@ describe('Content Example', () => {
73
73
} ) ;
74
74
} ) ;
75
75
76
+ describe ( 'HTML or DOM content' , ( ) => {
77
+ it ( 'should be worked if string HTML is passed' , ( ) => {
78
+ // Mouseover
79
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { className : 'target html' } ) . refs . wrapper ;
80
+ TestUtils . Simulate . mouseEnter ( origin ) ;
81
+
82
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
83
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
84
+ assert ( tooltip . innerText === 'This is a html content.\nSanitized by DOMPurify.\n' ) ;
85
+ assert ( tooltip . innerHTML . indexOf ( '</script>' ) === - 1 ) ;
86
+ assert ( tooltip . innerHTML . indexOf ( '</a>' ) !== - 1 ) ;
87
+ assert ( tooltip . innerHTML . indexOf ( '</b>' ) !== - 1 ) ;
88
+ } ) ;
89
+
90
+ it ( 'should be worked if DOM element is passed' , ( ) => {
91
+ // Mouseover
92
+ const origin = firstComponent ( tree , Origin . WrappedComponent , { className : 'target dom' } ) . refs . wrapper ;
93
+ TestUtils . Simulate . mouseEnter ( origin ) ;
94
+
95
+ const tooltip = firstComponent ( tree , Tooltip . WrappedComponent ) . refs . tooltip ;
96
+ assert ( getStyleValue ( tooltip , 'visibility' ) === 'visible' ) ;
97
+ assert ( tooltip . innerText === 'RedGreenBlue\n' ) ;
98
+ assert ( tooltip . innerHTML . indexOf ( '</span>' ) !== - 1 ) ;
99
+ } ) ;
100
+ } ) ;
101
+
76
102
describe ( 'continuous updating content' , ( ) => {
77
103
it ( 'should be worked' , ( ) => {
78
104
// Mouseover
0 commit comments