-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: select-field not showing in correct place (#1400)
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
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
components/select/src/single-select-field/features/can_show_conditionally.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: Position of SelectField | ||
|
||
Scenario: Keeps position when parent is hidden initially | ||
Given a Select is hidden initially | ||
When someone hovers over it to show it | ||
And clicks the select | ||
Then the select dropdown should be in the correct position |
24 changes: 24 additions & 0 deletions
24
components/select/src/single-select-field/features/can_show_conditionally/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,24 @@ | ||
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor' | ||
|
||
Given('a Select is hidden initially', () => { | ||
cy.visitStory('SingleSelectField', 'With hidden parent') | ||
}) | ||
|
||
When('someone hovers over it to show it', () => { | ||
cy.get('.container .hiddenSelect').invoke('attr', 'style', 'display: block') | ||
}) | ||
|
||
When('clicks the select', () => { | ||
cy.get('[data-test="dhis2-uicore-select"]').click() | ||
}) | ||
|
||
Then('the select dropdown should be in the correct position', () => { | ||
cy.get('[data-test="hoverable-select-field"]').should('be.visible') | ||
cy.get('[data-test="dhis2-uicore-singleselectoption"]').should( | ||
($selectField) => { | ||
const { top, left } = $selectField.offset() | ||
expect(top).to.be.greaterThan(0) | ||
expect(left).to.be.greaterThan(0) | ||
} | ||
) | ||
}) |
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