Skip to content

Commit 6d807cb

Browse files
committed
tobevisible check
1 parent dfd4444 commit 6d807cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/ImageCard/ImageCard.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ describe('ImageCard', () => {
99
<ImageCard src="https://i.imgur.com/pEI5qWM.jpeg" alt="Cat 🐱" />
1010
)
1111
const image = await screen.findByRole('img')
12-
expect(image).toBeVisible()
1312
expect(image).toHaveAttribute('src', 'https://i.imgur.com/pEI5qWM.jpeg')
1413
expect(image).toHaveAttribute('alt', 'Cat 🐱')
14+
expect(image).toBeVisible()
1515
})
1616

1717
it('should apply custom width and height when provided', () => {
@@ -30,6 +30,7 @@ describe('ImageCard', () => {
3030
const image = screen.getByRole('img')
3131
expect(image).toHaveAttribute('width', testWidth.toString())
3232
expect(image).toHaveAttribute('height', testHeight.toString())
33+
expect(image).toBeVisible()
3334
})
3435

3536
it('should handle string-based width and height', () => {
@@ -48,6 +49,7 @@ describe('ImageCard', () => {
4849
const image = screen.getByRole('img')
4950
expect(image).toHaveAttribute('width', testWidth)
5051
expect(image).toHaveAttribute('height', testHeight)
52+
expect(image).toBeVisible()
5153
})
5254

5355
it('should render even when width and height are not provided', () => {
@@ -56,5 +58,6 @@ describe('ImageCard', () => {
5658
const image = screen.getByRole('img')
5759
expect(image).not.toHaveAttribute('width')
5860
expect(image).not.toHaveAttribute('height')
61+
expect(image).toBeVisible()
5962
})
6063
})

0 commit comments

Comments
 (0)