From f43d10cec632687f6380a0f7f08403147edc1d9d Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Wed, 11 Oct 2023 15:21:55 +0200 Subject: [PATCH] refactor: restore e2e test for multiselect dropdown --- .../integration/e2e-test/fluentComponents.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/js/cypress/integration/e2e-test/fluentComponents.js b/js/cypress/integration/e2e-test/fluentComponents.js index a7bb51b6..95c2ff64 100644 --- a/js/cypress/integration/e2e-test/fluentComponents.js +++ b/js/cypress/integration/e2e-test/fluentComponents.js @@ -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}`); @@ -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()', () => {