-
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.
fixed suggested items from code review. Added better component tests
- Loading branch information
Matt Mangan
committed
Dec 13, 2023
1 parent
c384768
commit 8d1049f
Showing
8 changed files
with
31 additions
and
73 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.separation-line { | ||
margin: 1em 0; | ||
border-bottom: 1px solid #dee2e6; | ||
} |
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 |
---|---|---|
|
@@ -12,9 +12,4 @@ | |
|
||
.tab-container { | ||
padding: 1em 0; | ||
} | ||
|
||
.separation-line { | ||
margin: 1em 0; | ||
border-bottom: 1px solid #dee2e6; | ||
} |
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
30 changes: 14 additions & 16 deletions
30
tests/component/views/create-dataset/CreateDataset.spec.tsx
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,24 +1,22 @@ | ||
import CreateDatasetContainer from '../../../../src/views/create-dataset/CreateDatasetContainer' | ||
|
||
describe('Form component', () => { | ||
it('should render all form fields', () => { | ||
beforeEach(() => { | ||
cy.customMount(<CreateDatasetContainer />) | ||
cy.get('[data-cy=datasetFormInputTitle]').should('be.visible') | ||
cy.get('[data-cy=datasetFormSubmit]').should('be.visible') | ||
cy.get('[data-cy=datasetFormCancel]').should('be.visible') | ||
}) | ||
it('can submit a valid form', () => { | ||
cy.findByText(/Create Dataset/i).should('exist') | ||
cy.findByText(/Title/i).should('exist') | ||
|
||
it('should submit the form with correct values', () => { | ||
cy.customMount(<CreateDatasetContainer />) | ||
|
||
cy.get('[data-cy=datasetFormInputTitle]').type('Test Dataset Title') | ||
|
||
cy.get('[data-cy=datasetFormSubmit]').click() | ||
|
||
// Wait for the form submission to complete (adjust the timeout as needed) | ||
cy.wait(4000) | ||
|
||
// Assert that the form was successfully submitted | ||
cy.contains('Form Submitted!') | ||
cy.get('input[name="createDatasetTitle"]') | ||
.should('exist') | ||
.type('Test Dataset Title') | ||
.should('have.attr', 'required', 'required') | ||
.and('have.value', 'Test Dataset Title') | ||
cy.findByText(/Save Dataset/i).should('exist') | ||
cy.findByText(/Cancel/i).should('exist') | ||
cy.log('Submit form') | ||
cy.findByText(/Save Dataset/i).click() | ||
cy.findByText('Form Submitted!', { timeout: 5000 }) | ||
}) | ||
}) |