Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas742 committed Sep 12, 2023
1 parent 0f0dbb3 commit 05c291b
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions packages/main/src/components/FilterBar/FilterBar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const variants = (
</VariantManagement>
);

const search = <Input placeholder={'Search'} />;

describe('FilterBar.cy.tsx', () => {
it('Toggle FilterBar filters', () => {
const toggle = cy.spy().as('toggleSpy');
Expand Down Expand Up @@ -249,7 +247,7 @@ describe('FilterBar.cy.tsx', () => {

it('toolbar', () => {
cy.mount(
<FilterBar search={search} header={variants} hideToolbar={false} showGoOnFB>
<FilterBar header={variants} hideToolbar={false} showGoOnFB>
<FilterGroupItem label="Classification" key="classification" data-testid="SELECT">
<Select>
<Option>Option 1</Option>
Expand All @@ -265,12 +263,11 @@ describe('FilterBar.cy.tsx', () => {
cy.findByText('Filters');
cy.findByText('Adapt Filters').should('not.exist');
cy.findByText('Hide Filter Bar');
cy.findByPlaceholderText('Search');
cy.findByTestId('variantManagement');
cy.findByTestId('SELECT');

cy.mount(
<FilterBar search={search} header={variants} hideToolbar={true} showGoOnFB>
<FilterBar header={variants} hideToolbar={true} showGoOnFB>
<FilterGroupItem label="Classification" key="classification" data-testid="SELECT">
<Select>
<Option>Option 1</Option>
Expand Down Expand Up @@ -449,6 +446,26 @@ describe('FilterBar.cy.tsx', () => {
cy.get('[show-colon="true"]').should('have.length', 2);
});

it('FB search field', () => {
cy.mount(
<FilterBar search={<Input />}>
<FilterGroupItem>
<Input />
</FilterGroupItem>
<FilterGroupItem label="Input">
<Input placeholder="Placeholder" />
</FilterGroupItem>
</FilterBar>
);
cy.get('[ui5-input]').each(($el, index) => {
if (index === 0) {
cy.wrap($el).should('be.visible').and('have.attr', 'data-component-name', 'FilterBarSearch');
} else {
cy.wrap($el).should('be.visible').and('not.have.attr', 'data-component-name', 'FilterBarSearch');
}
});
});

mountWithCustomTagName(FilterBar);

cypressPassThroughTestsFactory(FilterBar);
Expand Down

0 comments on commit 05c291b

Please sign in to comment.