@@ -121,15 +121,15 @@ describe("Basic parsing", () => {
121121 expect ( section . children [ 0 ] . textContent ) . toBe ( "world" ) ;
122122 } ) ;
123123
124- test ( "When a an element and slide comment, then it adds attributes to the respective HTML elements." , async ( ) => {
124+ test ( "When an element and slide comment, then it adds attributes to the respective HTML elements." , async ( ) => {
125125 SECTION . setAttribute (
126126 "data-markdown-plain" ,
127127 [
128128 "# hello" ,
129129 '<!-- .slide: class="test-slide" style="color: red;" data-visibility="hidden" -->' ,
130130 '<!-- .element: style="color: green;" class="test-element" -->' ,
131131 "- list element" ,
132- '- list element 2 <!-- .element: class="test-li" style="color: orange;"-->' ,
132+ '- list element 2 <!-- .element: un-cloak="" class="test-li" style="color: orange;"-->' ,
133133 '<!-- .element: class="test-ul" style="color: blue;"-->' ,
134134 ] . join ( "\n" ) ,
135135 ) ;
@@ -161,6 +161,7 @@ describe("Basic parsing", () => {
161161 expect ( section . children [ 1 ] . style . color ) . toBe ( "blue" ) ;
162162 expect ( section . children [ 1 ] . children . length ) . toBe ( 2 ) ;
163163 expect ( section . children [ 1 ] . children [ 1 ] . getAttributeNames ( ) ) . toEqual ( [
164+ "un-cloak" ,
164165 "class" ,
165166 "style" ,
166167 ] ) ;
@@ -560,6 +561,35 @@ describe("Relative URL rewriting", () => {
560561 `${ markedOptions . baseUrl } test.png` ,
561562 ) ;
562563 } ) ;
564+
565+ test ( "When a URL is to provided, it is never rebased" , async ( ) => {
566+ SECTION . setAttribute (
567+ "data-markdown-plain" ,
568+ [
569+ "# hello" ,
570+ '<img src="https://test.example.com/test.png" />' ,
571+ '<a href="https://test.example.com/test.png">link</a>' ,
572+ '<a href="tel:0123458789">tel</a>' ,
573+ '<a href="mailto:[email protected] ">mail</a>' , 574+ ] . join ( "\n" ) ,
575+ ) ;
576+ const metadata = await preProcessSlides ( DIV ) ;
577+ expect ( metadata ) . toStrictEqual ( { } ) ;
578+ await convertMarkdownToSlides ( DIV , marked ) ;
579+ expect ( DIV . children . length ) . toBe ( 1 ) ;
580+ const section = DIV . children [ 0 ] ;
581+ expect ( section . children . length ) . toBe ( 5 ) ;
582+ expect ( section . children [ 1 ] . getAttribute ( "src" ) ) . toBe (
583+ "https://test.example.com/test.png" ,
584+ ) ;
585+ expect ( section . children [ 2 ] . getAttribute ( "href" ) ) . toBe (
586+ "https://test.example.com/test.png" ,
587+ ) ;
588+ expect ( section . children [ 3 ] . getAttribute ( "href" ) ) . toBe ( "tel:0123458789" ) ;
589+ expect ( section . children [ 4 ] . getAttribute ( "href" ) ) . toBe (
590+ 591+ ) ;
592+ } ) ;
563593} ) ;
564594
565595describe ( "Security" , ( ) => {
0 commit comments