Skip to content

Commit

Permalink
fix scrollbox unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed May 15, 2024
1 parent 4eb1e84 commit ea10184
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const mockIntersectionObserver = makeMockIntersectionObserver(
)

const expectLine = (e: 'top' | 'bottom', visible: boolean) =>
expect(screen.getByTestId('scroll-box')).toHaveAttribute(
expect(screen.getByTestId(`scrollbox-${e}-line`)).toHaveAttribute(
`data-${e}-line`,
visible ? 'true' : 'false',
)
Expand Down
7 changes: 6 additions & 1 deletion components/src/components/atoms/ScrollBox/ScrollBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,15 @@ export const ScrollBox = ({
ref={bottomRef}
/>
</StyledScrollBox>
<Divider $horizontalPadding={horizontalPadding} data-top-line={showTop} />
<Divider
$horizontalPadding={horizontalPadding}
data-testid="scrollbox-top-line"
data-top-line={showTop}
/>
<Divider
$horizontalPadding={horizontalPadding}
data-bottom-line={showBottom}
data-testid="scrollbox-bottom-line"
/>
</Container>
)
Expand Down

0 comments on commit ea10184

Please sign in to comment.