Skip to content

Commit

Permalink
feat(actions): Test actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac committed Oct 9, 2024
1 parent 8972b18 commit 610eebb
Showing 1 changed file with 26 additions and 14 deletions.
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');
});
});

0 comments on commit 610eebb

Please sign in to comment.