Skip to content

Commit

Permalink
refactor: restore e2e test for multiselect dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Sobolewski committed Oct 11, 2023
1 parent 914518c commit f43d10c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions js/cypress/integration/e2e-test/fluentComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ function dropdownChangeTest() {
cy.get('#fluentInputs-dropdownValue').contains('Value: C');
}

function dropdownMultiselectDefaultTest(value = 'Option A, Option C', output = 'Value: A Value: C') {
cy.get('#fluentInputs-dropdownMultiselect').within(() => {
cy.get('#fluentInputs-dropdownMultiselect-option').should('contain', `${value}`);
});
cy.get('#fluentInputs-dropdownMultiselectValue').should('contain', `${output}`);
}

function dropdownMultiselectChangeTest() {
cy.get('#fluentInputs-dropdownMultiselect-option').click();
cy.get('#fluentInputs-dropdownMultiselect-list0').parent().click();
cy.get('#fluentInputs-dropdownMultiselect-list1').parent().click();
cy.get('#fluentInputs-dropdownMultiselect-option').should('contain', 'Option C, Option B');
cy.get('#fluentInputs-dropdownMultiselectValue').contains('Value: C Value: B');
}

function datePickerDefaultTest(date = 'Thu Jun 25 2020', dttm = '2020-06-25T12:00:00.000Z') {
cy.get('#fluentInputs-datePicker-label').should('have.attr', 'value', date);
cy.get('#fluentInputs-datePickerValue').should('contain', `Value: ${dttm}`);
Expand Down Expand Up @@ -342,6 +357,14 @@ describe('Dropdown.shinyInput()', () => {
it('value change works', () => {
dropdownChangeTest();
});

it('setting default values for multiSelect works', () => {
dropdownMultiselectDefaultTest();
});

it('updating multiSelect options and values works', () => {
dropdownMultiselectChangeTest();
});
});

describe('DatePicker.shinyInput()', () => {
Expand Down

0 comments on commit f43d10c

Please sign in to comment.