forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Card): added tests for new clickable/selectable (patternfly#9262)
* chore(Card): added tests for new clickable/selectable * Added tests for clickable cards * Updated card with actions test
- Loading branch information
1 parent
937d3f4
commit 55789d0
Showing
4 changed files
with
306 additions
and
73 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
packages/react-core/src/components/Card/__tests__/CardSelectableActions.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { CardSelectableActions } from '../CardSelectableActions'; | ||
|
||
test('Matches the snapshot', () => { | ||
const { asFragment } = render(<CardSelectableActions>Test</CardSelectableActions>); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
test('Renders without children', () => { | ||
render(<CardSelectableActions data-testid="card-selectable-actions" />); | ||
|
||
expect(screen.getByTestId('card-selectable-actions')).toBeVisible(); | ||
}); | ||
|
||
test('Renders children', () => { | ||
render(<CardSelectableActions>Test</CardSelectableActions>); | ||
|
||
expect(screen.getByText('Test')).toBeVisible(); | ||
}); | ||
|
||
test('Renders with class name pf-v5-c-card__selectable-actions', () => { | ||
render(<CardSelectableActions>Test</CardSelectableActions>); | ||
|
||
expect(screen.getByText('Test')).toHaveClass('pf-v5-c-card__selectable-actions'); | ||
}); | ||
|
||
test('Renders with custom class names provided via prop', () => { | ||
render(<CardSelectableActions className="test-class">Test</CardSelectableActions>); | ||
|
||
expect(screen.getByText('Test')).toHaveClass('test-class'); | ||
}); |
11 changes: 11 additions & 0 deletions
11
...eact-core/src/components/Card/__tests__/__snapshots__/CardSelectableActions.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Matches the snapshot 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="pf-v5-c-card__selectable-actions" | ||
> | ||
Test | ||
</div> | ||
</DocumentFragment> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.