Skip to content

Commit

Permalink
fixup! Turn article name into a link that opens in a new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Nov 6, 2024
1 parent e49ee5d commit cfa1901
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Helpjuice/Helpjuice.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ describe('Helpjuice', () => {
expect(
await screen.findByRole('link', { name: 'Article Name' }),
).toHaveAttribute('href', 'https://domain.helpjuice.com/article-1');

// Simulate clicking on another article, which will replace #article-content-name and change data-current-question-id
document.getElementById('article-content-name')!.textContent =
'Another Article Name';
document
.getElementsByClassName('hj-swifty')[0]
.setAttribute('data-current-question-id', 'article-2');
expect(
await screen.findByRole('link', { name: 'Another Article Name' }),
).toHaveAttribute('href', 'https://domain.helpjuice.com/article-2');
});

it('does nothing if the element is missing', () => {
Expand Down

0 comments on commit cfa1901

Please sign in to comment.