Skip to content

Commit

Permalink
Write E2E Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Sep 25, 2023
1 parent c5639c7 commit ca66578
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/components/combo_box/combo_box.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,42 @@ describe('EuiComboBox', () => {
});
});

describe('input auto sizing', () => {
it('resizes the width of the input based to fit the search text', () => {
cy.realMount(<EuiComboBox options={[]} />);
cy.get('[data-test-subj="comboBoxSearchInput"]').should(
'have.attr',
'style',
'inline-size: 2px;'
);

cy.get('[data-test-subj="comboBoxSearchInput"]').realClick();
cy.realType('lorem ipsum dolor');
cy.get('[data-test-subj="comboBoxSearchInput"]').should(
'have.attr',
'style',
'inline-size: 121px;'
);
});

it('does not exceed the maximum possible width of the input wrapper', () => {
cy.realMount(<EuiComboBox options={[]} />);
cy.get('[data-test-subj="comboBoxSearchInput"]').realClick();
cy.realType(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit......'
);

cy.get('[data-test-subj="comboBoxSearchInput"]').should(
'have.attr',
'style',
'inline-size: 387px;'
);
cy.get('[data-test-subj="comboBoxSearchInput"]')
.invoke('width')
.should('be.eq', 354);
});
});

describe('truncation', () => {
const sharedProps = {
style: { width: 200 },
Expand Down

0 comments on commit ca66578

Please sign in to comment.