-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
break out into separate files, pr feedback
- Loading branch information
Showing
16 changed files
with
453 additions
and
331 deletions.
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
packages/react-core/src/components/DataList/__tests__/DataListAction.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,63 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { DataListAction } from '../DataListAction'; | ||
|
||
import styles from '@patternfly/react-styles/css/components/DataList/data-list'; | ||
|
||
test('Renders to match snapshot', () => { | ||
const { asFragment } = render( | ||
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action"> | ||
test | ||
</DataListAction> | ||
); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
test(`Renders with default class ${styles.dataListItemAction}`, () => { | ||
render( | ||
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action" className="test-class"> | ||
test | ||
</DataListAction> | ||
); | ||
expect(screen.getByText('test')).toHaveClass(styles.dataListItemAction); | ||
}); | ||
|
||
test(`Renders with custom class when className is passed`, () => { | ||
render( | ||
<DataListAction aria-label="Actions" aria-labelledby="ex-action" id="ex-action" className="test-class"> | ||
test | ||
</DataListAction> | ||
); | ||
expect(screen.getByText('test')).toHaveClass('test-class'); | ||
}); | ||
|
||
test('Renders button with visibliity breakpoint set', () => { | ||
render( | ||
<DataListAction | ||
visibility={{ default: 'hidden', lg: 'visible' }} | ||
aria-labelledby="check-action-item2 check-action-action2" | ||
id="check-action-action2" | ||
aria-label="Actions" | ||
> | ||
test | ||
</DataListAction> | ||
); | ||
|
||
expect(screen.getByText('test')).toHaveClass('pf-m-hidden'); | ||
expect(screen.getByText('test')).toHaveClass('pf-m-visible-on-lg'); | ||
}); | ||
|
||
test('Does not render button with hidden breakpoint set', () => { | ||
render( | ||
<DataListAction | ||
visibility={{ '2xl': 'hidden' }} | ||
aria-labelledby="check-action-item2 check-action-action2" | ||
id="check-action-action2" | ||
aria-label="Actions" | ||
> | ||
test | ||
</DataListAction> | ||
); | ||
|
||
expect(screen.getByText('test')).toHaveClass('pf-m-hidden-on-2xl'); | ||
}); |
Oops, something went wrong.