@@ -95,13 +95,13 @@ describe('ShareModal', () => {
9595 const actions = Array . from ( container . querySelector ( '.gh-portal-share-actions' ) . children ) ;
9696 expect ( actions [ 0 ] ) . toHaveClass ( 'gh-portal-share-action' , 'copy' ) ;
9797 expect ( actions [ 1 ] ) . toHaveClass ( 'gh-portal-share-action' , 'twitter' ) ;
98- expect ( actions [ 2 ] ) . toHaveClass ( 'gh-portal-share-action' , 'facebook ' ) ;
98+ expect ( actions [ 2 ] ) . toHaveClass ( 'gh-portal-share-action' , 'linkedin ' ) ;
9999 expect ( actions [ 3 ] ) . toHaveClass ( 'gh-portal-share-action' , 'email' ) ;
100100 expect ( actions [ 4 ] ) . toHaveClass ( 'gh-portal-share-more' ) ;
101101
102102 const copyButton = getByRole ( 'button' , { name : 'Copy link' } ) ;
103103 const twitterLink = getByRole ( 'link' , { name : 'X (Twitter)' } ) ;
104- const facebookLink = getByRole ( 'link' , { name : 'Facebook ' } ) ;
104+ const linkedInLink = getByRole ( 'link' , { name : 'LinkedIn ' } ) ;
105105 const emailLink = getByRole ( 'link' , { name : 'Email' } ) ;
106106 const moreOptionsButton = getByRole ( 'button' , { name : 'More options' } ) ;
107107
@@ -110,15 +110,17 @@ describe('ShareModal', () => {
110110 expect ( queryByRole ( 'menu' ) ) . not . toBeInTheDocument ( ) ;
111111
112112 const twitterUrl = new URL ( twitterLink . getAttribute ( 'href' ) ) ;
113- const facebookUrl = new URL ( facebookLink . getAttribute ( 'href' ) ) ;
113+ const linkedInUrl = new URL ( linkedInLink . getAttribute ( 'href' ) ) ;
114114 const emailUrl = new URL ( emailLink . getAttribute ( 'href' ) ) ;
115115
116116 expect ( twitterUrl . origin + twitterUrl . pathname ) . toBe ( 'https://twitter.com/intent/tweet' ) ;
117117 expect ( twitterUrl . searchParams . get ( 'url' ) ) . toBe ( 'https://example.com/post?ref=test' ) ;
118118 expect ( twitterUrl . searchParams . get ( 'text' ) ) . toBe ( 'Example post title' ) ;
119119
120- expect ( facebookUrl . origin + facebookUrl . pathname ) . toBe ( 'https://www.facebook.com/sharer/sharer.php' ) ;
121- expect ( facebookUrl . searchParams . get ( 'u' ) ) . toBe ( 'https://example.com/post?ref=test' ) ;
120+ expect ( linkedInUrl . origin + linkedInUrl . pathname ) . toBe ( 'https://www.linkedin.com/shareArticle' ) ;
121+ expect ( linkedInUrl . searchParams . get ( 'mini' ) ) . toBe ( 'true' ) ;
122+ expect ( linkedInUrl . searchParams . get ( 'url' ) ) . toBe ( 'https://example.com/post?ref=test' ) ;
123+ expect ( linkedInUrl . searchParams . get ( 'title' ) ) . toBe ( 'Example post title' ) ;
122124
123125 expect ( emailUrl . protocol ) . toBe ( 'mailto:' ) ;
124126 expect ( emailUrl . searchParams . get ( 'subject' ) ) . toBe ( 'Example post title' ) ;
@@ -134,16 +136,16 @@ describe('ShareModal', () => {
134136 expect ( moreOptionsButton ) . toHaveAttribute ( 'aria-expanded' , 'true' ) ;
135137 expect ( getByRole ( 'menu' ) ) . toBeInTheDocument ( ) ;
136138
137- const linkedInLink = getByRole ( 'menuitem' , { name : 'LinkedIn ' } ) ;
139+ const facebookLink = getByRole ( 'menuitem' , { name : 'Facebook ' } ) ;
138140 const threadsLink = getByRole ( 'menuitem' , { name : 'Threads' } ) ;
139141 const blueskyLink = getByRole ( 'menuitem' , { name : 'Bluesky' } ) ;
140142
141- const linkedInUrl = new URL ( linkedInLink . getAttribute ( 'href' ) ) ;
143+ const facebookUrl = new URL ( facebookLink . getAttribute ( 'href' ) ) ;
142144 const threadsUrl = new URL ( threadsLink . getAttribute ( 'href' ) ) ;
143145 const blueskyUrl = new URL ( blueskyLink . getAttribute ( 'href' ) ) ;
144146
145- expect ( linkedInUrl . origin + linkedInUrl . pathname ) . toBe ( 'https://www.linkedin .com/sharing/share-offsite/ ' ) ;
146- expect ( linkedInUrl . searchParams . get ( 'url ' ) ) . toBe ( 'https://example.com/post?ref=test' ) ;
147+ expect ( facebookUrl . origin + facebookUrl . pathname ) . toBe ( 'https://www.facebook .com/sharer/sharer.php ' ) ;
148+ expect ( facebookUrl . searchParams . get ( 'u ' ) ) . toBe ( 'https://example.com/post?ref=test' ) ;
147149
148150 expect ( threadsUrl . origin + threadsUrl . pathname ) . toBe ( 'https://www.threads.net/intent/post' ) ;
149151 expect ( threadsUrl . searchParams . get ( 'text' ) ) . toBe ( 'Example post title https://example.com/post?ref=test' ) ;
@@ -186,9 +188,7 @@ describe('ShareModal', () => {
186188
187189 const { getByRole, getByText, queryByTestId} = setup ( ) ;
188190
189- fireEvent . click ( getByRole ( 'button' , { name : 'More options' } ) ) ;
190-
191- const linkedInLink = getByRole ( 'menuitem' , { name : 'LinkedIn' } ) ;
191+ const linkedInLink = getByRole ( 'link' , { name : 'LinkedIn' } ) ;
192192 const linkedInUrl = new URL ( linkedInLink . getAttribute ( 'href' ) ) ;
193193
194194 expect ( linkedInUrl . searchParams . get ( 'url' ) ) . toBe ( window . location . href ) ;
0 commit comments