@@ -16,10 +16,11 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
1616 expect ( html ) . toContain ( '<h1' )
1717 expect ( html ) . toContain ( '<a' )
1818 expect ( html ) . toContain ( 'href="#' )
19- expect ( html ) . toContain ( 'class="heading-anchor' )
19+ expect ( html ) . toContain ( 'group' )
20+ expect ( html ) . toContain ( 'no-underline' )
2021 } )
2122
22- it ( 'should use the hard-coded emoji anchor content' , async ( ) => {
23+ it ( 'should use an inline SVG link icon as anchor content' , async ( ) => {
2324 const markdown = '## Section Title'
2425
2526 const html = await processIsolated ( {
@@ -29,8 +30,10 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
2930 slugify : true ,
3031 } )
3132
32- expect ( html ) . toContain ( '🔗' )
33- expect ( html ) . toContain ( 'class="anchor-link' )
33+ expect ( html ) . toContain ( '<svg' )
34+ expect ( html ) . toContain ( '<path' )
35+ expect ( html ) . toContain ( 'inline-block' )
36+ expect ( html ) . toContain ( 'opacity-0' )
3437 } )
3538
3639 it ( 'should set aria-hidden on anchor content span' , async ( ) => {
@@ -59,7 +62,7 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
5962 expect ( html ) . toContain ( 'aria-label="Link to this section"' )
6063 } )
6164
62- it ( 'should add no-underline classes to the anchor link' , async ( ) => {
65+ it ( 'should add group and transition classes to the anchor link' , async ( ) => {
6366 const markdown = '## Styled Heading'
6467
6568 const html = await processIsolated ( {
@@ -69,6 +72,7 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
6972 slugify : true ,
7073 } )
7174
75+ expect ( html ) . toContain ( 'group' )
7276 expect ( html ) . toContain ( 'no-underline' )
7377 expect ( html ) . toContain ( 'transition-colors' )
7478 } )
@@ -95,7 +99,7 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
9599 expect ( html ) . toContain ( '<h5' )
96100 expect ( html ) . toContain ( '<h6' )
97101
98- const anchorCount = ( html . match ( / c l a s s = " a n c h o r - l i n k \b / g) || [ ] ) . length
102+ const anchorCount = ( html . match ( / o p a c i t y - 0 / g) || [ ] ) . length
99103 expect ( anchorCount ) . toBe ( 6 )
100104 } )
101105
@@ -110,7 +114,8 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
110114 } )
111115
112116 expect ( html ) . toContain ( '<h1' )
113- expect ( html ) . not . toContain ( 'class="heading-anchor' )
117+ expect ( html ) . not . toContain ( 'group' )
118+ expect ( html ) . not . toContain ( '<svg' )
114119 } )
115120
116121 it ( 'should handle headings with code' , async ( ) => {
@@ -125,7 +130,7 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
125130
126131 expect ( html ) . toContain ( '<h2' )
127132 expect ( html ) . toContain ( '<code>' )
128- expect ( html ) . toContain ( '🔗 ' )
133+ expect ( html ) . toContain ( '<svg ' )
129134 } )
130135
131136 it ( 'should handle multiple headings with the same text' , async ( ) => {
@@ -140,7 +145,7 @@ describe('rehype-autolink-headings plugin (Layer 1: Isolated)', () => {
140145 slugify : true ,
141146 } )
142147
143- const anchorCount = ( html . match ( / c l a s s = " a n c h o r - l i n k \b / g) || [ ] ) . length
148+ const anchorCount = ( html . match ( / o p a c i t y - 0 / g) || [ ] ) . length
144149 expect ( anchorCount ) . toBe ( 3 )
145150 } )
146151} )
0 commit comments