-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use string based selection in multi- and single-select
- Loading branch information
Showing
37 changed files
with
188 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
cypress/integration/MultiSelect/duplicate_option_values.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Duplicate option values result in a conflict between the input and dropdown UI | ||
|
||
Scenario: The MultiSelect has options with a duplicate value and this value is selected | ||
Given a MultiSelect with options with a duplicate value and this value is selected | ||
And the MultiSelect is open | ||
Then the first option with the selected value is displayed in the input | ||
But both options are highlighted in the dropdown |
22 changes: 22 additions & 0 deletions
22
cypress/integration/MultiSelect/duplicate_option_values/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import '../common' | ||
import { Given, Then } from 'cypress-cucumber-preprocessor/steps' | ||
|
||
Given( | ||
'a MultiSelect with options with a duplicate value and this value is selected', | ||
() => { | ||
cy.visitStory('MultiSelect', 'With duplicate selected option values') | ||
} | ||
) | ||
Then( | ||
'the first option with the selected value is displayed in the input', | ||
() => { | ||
cy.get('[data-test="dhis2-uicore-select-input"]').should( | ||
'contain', | ||
'option one' | ||
) | ||
} | ||
) | ||
Then('both options are highlighted in the dropdown', () => { | ||
cy.get('input[name="option one"]').should('have.attr', 'checked') | ||
cy.get('input[name="option one a"]').should('have.attr', 'checked') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
cypress/integration/SingleSelect/duplicate_option_values.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Duplicate option values result in a conflict between the input and dropdown UI | ||
|
||
Scenario: The SingleSelect has options with a duplicate value and this value is selected | ||
Given a SingleSelect with options with a duplicate value and this value is selected | ||
And the SingleSelect is open | ||
Then the first option with the selected value is displayed in the input | ||
But both options are highlighted in the dropdown |
27 changes: 27 additions & 0 deletions
27
cypress/integration/SingleSelect/duplicate_option_values/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '../common' | ||
import { Given, Then } from 'cypress-cucumber-preprocessor/steps' | ||
|
||
Given( | ||
'a SingleSelect with options with a duplicate value and this value is selected', | ||
() => { | ||
cy.visitStory('SingleSelect', 'With duplicate selected option values') | ||
} | ||
) | ||
Then( | ||
'the first option with the selected value is displayed in the input', | ||
() => { | ||
cy.get('[data-test="dhis2-uicore-select-input"]').should( | ||
'contain', | ||
'option one' | ||
) | ||
} | ||
) | ||
Then('both options are highlighted in the dropdown', () => { | ||
cy.get('[data-test="dhis2-uicore-singleselectoption"]') | ||
.contains('option one') | ||
.should('have.class', 'active') | ||
|
||
cy.get('[data-test="dhis2-uicore-singleselectoption"]') | ||
.contains('option one a') | ||
.should('have.class', 'active') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.