This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Start a new submission #48
Open
jasnakai
wants to merge
10
commits into
main
Choose a base branch
from
jn-424-start-new-submission
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c22516b
Added modal and navigate functionality.
jasnakai d307fe9
Adding cypress test.
jasnakai d1e6564
Address review feedback on draft PR.
jasnakai 7f85680
Resolving conflict.
jasnakai aeef3b6
Commit after merge from main.
jasnakai 99657a9
Updating tests and pa11y config.
jasnakai 37b3232
Fixing test issue.
jasnakai 16263ff
Fixed cypress issue.
jasnakai 571b4eb
Updated Cypress test.
jasnakai 02a6b14
Fixed pa11yci typo.
jasnakai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
| describe('Display my audit submissions', () => { | ||
| before(() => { | ||
| cy.visit('/submissions'); | ||
| }); | ||
| describe('On correct page.', () => { | ||
| it('should have correct title', () => { | ||
| cy.get('h1').should('have.text', 'My audit submissions'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('test Start new submission button', () => { | ||
| it('should be disbaled to start', () => { | ||
| cy.get('#start-submission').should('have.attr', 'disabled'); | ||
| }); | ||
| it('should be enabled when checkbox checked', () => { | ||
| cy.get('#check-start-new-submission').click({ force: true }); | ||
| cy.get('#start-submission').should('not.have.attr', 'disabled'); | ||
| }); | ||
| it('should be disabled when checkbox unchecked', () => { | ||
| cy.get('#check-start-new-submission').click({ force: true }); | ||
| cy.get('#start-submission').should('have.attr', 'disabled'); | ||
| }); | ||
| it('should navigate to first step in new submission process on click', () => { | ||
| cy.get('#check-start-new-submission').click({ force: true }); | ||
| cy.get('#start-submission').click(); | ||
| cy.get('h1').should('have.text', 'Create new audit'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('test terms and conditions modal trigger', () => { | ||
| before(() => { | ||
| cy.visit('/submissions'); | ||
| }); | ||
| it('should have the modal as hidden by default', () => { | ||
| cy.get('#modal-terms-conditions').should('have.class', 'is-hidden'); | ||
| }); | ||
| it('should unhide the modal and close it', () => { | ||
| cy.get('#terms-conditions-trigger').click(); | ||
| cy.get('#modal-terms-conditions').should('not.have.class', 'is-hidden'); | ||
| cy.get('#modal-terms-conditions .usa-modal__close').click(); | ||
| cy.get('#modal-terms-conditions').should('have.class', 'is-hidden'); | ||
| }); | ||
| it('should navigate to first step in new submission process', () => { | ||
| cy.get('#terms-conditions-trigger').click(); | ||
| cy.get('#modal-terms-conditions').should('not.have.class', 'is-hidden'); | ||
| cy.get('#modal-terms-continue').click(); | ||
| cy.get('h1').should('have.text', 'Create new audit'); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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,18 +1,50 @@ | ||
| (function () { | ||
| function init() { | ||
| const START_SUBMISSION_URL = '../audit/new/step-1/'; | ||
| prepUEIModal(); | ||
| prepTermsConditionsModal(START_SUBMISSION_URL); | ||
| } | ||
| function prepUEIModal() { | ||
| const submissions_table = document.getElementById('audit-submissions'); | ||
| const uei_link = submissions_table.querySelector('th .usa-link'); | ||
| uei_link.setAttribute('href', '#modal-uei-info'); | ||
| uei_link.setAttribute('aria-controls', 'modal-uei-info'); | ||
| uei_link.setAttribute('data-open-modal', ''); | ||
|
|
||
| const button_group = document.querySelector( | ||
| '#modal-uei-info .usa-button-group' | ||
| const modal_uei_second_button = document.querySelector( | ||
| '#modal-uei-info-cancel' | ||
| ); | ||
| modal_uei_second_button.parentElement.remove(); | ||
| } | ||
| function prepTermsConditionsModal(START_SUBMISSION_URL) { | ||
| const terms_form = document.querySelector('#start-new-submission'); | ||
| terms_form.addEventListener('submit', (e) => { | ||
| e.preventDefault(); | ||
| }); | ||
| const terms_checkbox = terms_form.querySelector( | ||
| '#check-start-new-submission' | ||
| ); | ||
| const second_button = button_group.querySelectorAll( | ||
| '.usa-button-group__item' | ||
| )[1]; | ||
| second_button.remove(); | ||
| const terms_start_sub = terms_form.querySelector('#start-submission'); | ||
| terms_checkbox.addEventListener('change', (e) => { | ||
| e.target.checked == true | ||
| ? (terms_start_sub.disabled = false) | ||
| : (terms_start_sub.disabled = true); | ||
| }); | ||
| const terms_trigger = terms_form.querySelector('#terms-conditions-trigger'); | ||
| terms_trigger.setAttribute('aria-controls', 'modal-terms-conditions'); | ||
| terms_trigger.setAttribute('data-open-modal', ''); | ||
| const button_accept = document.querySelector('#modal-terms-continue'); | ||
| button_accept.addEventListener('click', () => { | ||
| terms_checkbox.checked = true; | ||
| triggerEvent(terms_checkbox, 'change'); | ||
| window.location.href = START_SUBMISSION_URL; | ||
| }); | ||
| terms_start_sub.addEventListener('click', () => { | ||
| window.location.href = START_SUBMISSION_URL; | ||
| }); | ||
| } | ||
| function triggerEvent(element, eventName) { | ||
| var event = new Event(eventName); | ||
| element.dispatchEvent(event); | ||
| } | ||
| init(); | ||
| })(); | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.