File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
src/packages/tour/components Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { Header } from "./TourTooltip" ;
2
+
3
+ describe ( "Header" , ( ) => {
4
+ it ( "renders plain text title when renderAsHtml is false" , ( ) => {
5
+ const el = Header ( {
6
+ title : "<strong>Bold Text</strong>" ,
7
+ skipLabel : "Skip" ,
8
+ renderAsHtml : false ,
9
+ onSkipClick : jest . fn ( ) ,
10
+ } ) ;
11
+
12
+ const h1 = el . querySelector ( "h1" ) ! ;
13
+
14
+ expect ( h1 . innerHTML ) . toBe (
15
+ '<div class="introjs-tooltiptext"><strong>Bold Text</strong>'
16
+ ) ;
17
+ expect ( h1 . querySelector ( "strong" ) ) . toBeNull ( ) ;
18
+ } ) ;
19
+
20
+ it ( "renders HTML title when renderAsHtml is true" , ( ) => {
21
+ const el = Header ( {
22
+ title : "<strong>Bold Text</strong>" ,
23
+ skipLabel : "Skip" ,
24
+ renderAsHtml : true ,
25
+ onSkipClick : jest . fn ( ) ,
26
+ } ) ;
27
+
28
+ const h1 = el . querySelector ( "h1" ) ! ;
29
+
30
+ expect ( h1 . innerHTML ) . toBe (
31
+ '<div class="introjs-tooltiptext"><strong>Bold Text</strong>'
32
+ ) ;
33
+ expect ( h1 . querySelector ( "strong" ) ?. textContent ) . toBe ( "Bold Text" ) ;
34
+ } ) ;
35
+ } ) ;
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ const Buttons = ({
326
326
) ;
327
327
} ;
328
328
329
- const Header = ( {
329
+ export const Header = ( {
330
330
title,
331
331
skipLabel,
332
332
renderAsHtml,
You can’t perform that action at this time.
0 commit comments