Skip to content

Commit

Permalink
Merge pull request #478 from samvera-labs/active-item-class
Browse files Browse the repository at this point in the history
Build active structure item classname into a single line
  • Loading branch information
Dananji authored Apr 10, 2024
2 parents e19ca9d + f97a2bf commit 7d19a68
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/StructuredNavigation/NavUtils/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ const ListItem = ({
data-testid="list-item"
ref={liRef}
className={
`ramp--structured-nav__list-item
${(itemIdRef.current != undefined && (currentNavItem?.id === itemIdRef.current) && (isPlaylist || !isCanvas))
'ramp--structured-nav__list-item' +
`${(itemIdRef.current != undefined && (currentNavItem?.id === itemIdRef.current) && (isPlaylist || !isCanvas))
? ' active'
: ''
}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ describe('ListItem component', () => {
fireEvent.click(listItem.children[1]);
waitFor(() => {
expect(listItem).toHaveClass('active');
expect(listItem.className).toEqual('ramp--structured-nav__list-item active');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,7 @@ describe('SectionHeading component', () => {
);
expect(screen.queryAllByTestId('listitem-section')).toHaveLength(1);
expect(screen.getByTestId('listitem-section')).toHaveClass('active');
expect(screen.getByTestId('listitem-section').className)
.toEqual('ramp--structured-nav__section active');
});
});

0 comments on commit 7d19a68

Please sign in to comment.