-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MNT] Refactored the
DownloadResultButton
(#396)
* Implemented splitbutton for `DownloadResultButton` * Updated `GetDataDialog` component * Updated `ResultContainer` component * Updated `ResultsTSV` e2e test * Updated docker command * [ENH] Standardized query result files (#398) * Standardized query result files * Addressed the PR review comments * Addressed PR review comments
- Loading branch information
Showing
7 changed files
with
151 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,48 @@ | ||
import DownloadResultButton from '../../src/components/DownloadResultButton'; | ||
|
||
const props = { | ||
identifier: 'test', | ||
disabled: false, | ||
handleClick: () => {}, | ||
}; | ||
|
||
describe('DownloadResultButton', () => { | ||
it('Displays an enabled MUI Button with the identifier passed as prop', () => { | ||
cy.mount( | ||
<DownloadResultButton | ||
identifier={props.identifier} | ||
disabled={props.disabled} | ||
handleClick={props.handleClick} | ||
/> | ||
cy.mount(<DownloadResultButton disabled={props.disabled} handleClick={props.handleClick} />); | ||
cy.get('[data-cy="download-results-button"]').should('be.visible'); | ||
cy.get('[data-cy="download-results-button"]').should( | ||
'contain', | ||
'Download selected query results' | ||
); | ||
cy.get('[data-cy="test-download-results-button"]').should('be.visible'); | ||
cy.get('[data-cy="test-download-results-button"]').should('contain', 'Download test result'); | ||
cy.get('[data-cy="test-download-results-button"]').should('not.be', 'disabled'); | ||
cy.get('[data-cy="download-results-button"]').should('not.be', 'disabled'); | ||
}); | ||
it('Displays a disabled MUI Button and a tooltip when the button is hovered over', () => { | ||
cy.mount( | ||
<DownloadResultButton | ||
identifier={props.identifier} | ||
disabled | ||
handleClick={props.handleClick} | ||
/> | ||
it('Fires the handleClick event handler with the appropriate payload when the button is clicked', () => { | ||
const handleClickSpy = cy.spy().as('handleClickSpy'); | ||
cy.mount(<DownloadResultButton disabled={props.disabled} handleClick={handleClickSpy} />); | ||
cy.get('[data-cy="download-results-dropdown-button"]').click(); | ||
cy.contains('URIs').click(); | ||
cy.get('[data-cy="download-results-button"]').should( | ||
'contain', | ||
'Download selected query results with URIs' | ||
); | ||
cy.get('[data-cy="test-download-results-button"]').trigger('mouseover', { force: true }); | ||
cy.get('[data-cy="download-results-button"]').click(); | ||
cy.get('@handleClickSpy').should('have.been.calledWith', 1); | ||
cy.get('[data-cy="download-results-dropdown-button"]').click(); | ||
cy.contains(/results$/).click(); | ||
cy.get('[data-cy="download-results-button"]') | ||
.invoke('text') | ||
.should('match', /^Download selected query results$/); | ||
cy.get('[data-cy="download-results-button"]').click(); | ||
cy.get('@handleClickSpy').should('have.been.calledWith', 0); | ||
}); | ||
it('Displays a disabled MUI Button and a tooltip when the button is hovered over', () => { | ||
cy.mount(<DownloadResultButton disabled handleClick={props.handleClick} />); | ||
cy.get('[data-cy="download-results-button"]').trigger('mouseover', { force: true }); | ||
cy.get('.MuiTooltip-tooltip').should('contain', 'Please select at least one dataset'); | ||
}); | ||
it('Fires the handleClick event handler with the appropriate payload when the button is clicked', () => { | ||
const handleClickSpy = cy.spy().as('handleClickSpy'); | ||
cy.mount( | ||
<DownloadResultButton | ||
identifier={props.identifier} | ||
disabled={props.disabled} | ||
handleClick={handleClickSpy} | ||
/> | ||
); | ||
cy.get('[data-cy="test-download-results-button"]').click(); | ||
cy.get('@handleClickSpy').should('have.been.calledWith', 'test'); | ||
cy.mount(<DownloadResultButton disabled={props.disabled} handleClick={handleClickSpy} />); | ||
cy.get('[data-cy="download-results-button"]').click(); | ||
cy.get('@handleClickSpy').should('have.been.calledWith', 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
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.