Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add actions to the DataViewToolbar #24

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions cypress/component/DataViewToolbar.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
import React from 'react';
import { Pagination } from '@patternfly/react-core';
import { BulkSelect } from '@patternfly/react-component-groups/dist/dynamic/BulkSelect';
import { BulkSelect, ResponsiveAction, ResponsiveActions } from '@patternfly/react-component-groups';
import DataViewToolbar from '../../packages/module/dist/dynamic/DataViewToolbar';

describe('DataViewToolbar', () => {
it('renders the data view toolbar', () => {
cy.mount(<DataViewToolbar pagination={<Pagination page={1} perPage={10} />}
bulkSelect={
<BulkSelect
canSelectAll
pageCount={5}
totalCount={10}
selectedCount={2}
pageSelected={false}
pagePartiallySelected={true}
onSelect={() => null}
/>
}
/>)
cy.mount(
<DataViewToolbar
pagination={<Pagination page={1} perPage={10} />}
bulkSelect={
<BulkSelect
canSelectAll
pageCount={5}
totalCount={10}
selectedCount={2}
pageSelected={false}
pagePartiallySelected={true}
onSelect={() => null}
/>
}
actions={
<ResponsiveActions breakpoint="lg">
<ResponsiveAction isPersistent variant="primary">Persistent</ResponsiveAction>
<ResponsiveAction isPinned variant="secondary">Pinned</ResponsiveAction>
<ResponsiveAction>Action three</ResponsiveAction>
<ResponsiveAction>Action four</ResponsiveAction>
</ResponsiveActions>
}
/>
)
cy.get('[data-ouia-component-id="DataViewToolbar"]').should('exist');
cy.get('[data-ouia-component-id="DataViewToolbar-pagination"]').should('exist');
cy.get('[data-ouia-component-id="DataViewToolbar-bulk-select"]').should('exist');
cy.get('[data-ouia-component-id="ResponsiveActions-menu"]').should('exist');
});
});
Loading