-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updates login info component #34049
Merged
Merged
updates login info component #34049
Changes from all commits
Commits
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 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
33 changes: 33 additions & 0 deletions
33
src/applications/login/tests/mhv-access-page.cypress.spec.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,33 @@ | ||
describe('My HealtheVet Access Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/sign-in/mhv'); | ||
}); | ||
|
||
it('displays the page title and description', () => { | ||
cy.injectAxeThenAxeCheck(); | ||
cy.get('#signin-signup-modal-title') | ||
.should('exist') | ||
.and('contain', 'Access the My HealtheVet sign-in option'); | ||
cy.get('p.vads-u-measure--5') | ||
.should('exist') | ||
.and( | ||
'contain', | ||
'Get temporary access to the My HealtheVet sign-in option. This sign-in process may change in the future.', | ||
); | ||
}); | ||
|
||
it('displays a sign-in button and respond to clicks', () => { | ||
cy.injectAxeThenAxeCheck(); | ||
cy.get('va-button[text="My HealtheVet"]').should('exist'); | ||
cy.get('[data-testid="accessMhvBtn"]').click(); | ||
}); | ||
|
||
it('should display the "Having trouble signing in?" section', () => { | ||
cy.injectAxeThenAxeCheck(); | ||
cy.contains('h2', 'Having trouble signing in?').should('exist'); | ||
cy.contains( | ||
'p', | ||
'Contact the administrator who gave you access to this page.', | ||
).should('exist'); | ||
}); | ||
}); |
78 changes: 57 additions & 21 deletions
78
src/platform/user/authentication/components/LoginInfo.jsx
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,26 +1,62 @@ | ||
import React from 'react'; | ||
import { useFeatureToggle } from '~/platform/utilities/feature-toggles/useFeatureToggle'; | ||
import SubmitSignInForm from 'platform/static-data/SubmitSignInForm'; | ||
|
||
export default () => ( | ||
<div className="row"> | ||
<div className="columns print-full-width sign-in-wrapper"> | ||
<div className="help-info"> | ||
<h2 className="vads-u-margin-top--0">Having trouble signing in?</h2> | ||
<p> | ||
Get answers to common{' '} | ||
<a href="/resources/signing-in-to-vagov/"> | ||
questions about signing in | ||
</a>{' '} | ||
and{' '} | ||
<a href="/resources/verifying-your-identity-on-vagov/"> | ||
verifying your identity | ||
</a> | ||
. | ||
</p> | ||
<p> | ||
<SubmitSignInForm startSentence /> We're here 24/7. | ||
</p> | ||
export default () => { | ||
const { useToggleValue, TOGGLE_NAMES } = useFeatureToggle(); | ||
const mhvButtonDeprecated = useToggleValue( | ||
TOGGLE_NAMES.mhvCredentialButtonDisabled, | ||
); | ||
return ( | ||
<div className="row"> | ||
<div className="columns print-full-width sign-in-wrapper"> | ||
<div className="help-info"> | ||
<h2 className="vads-u-margin-top--0">Having trouble signing in?</h2> | ||
{mhvButtonDeprecated ? ( | ||
<div> | ||
<p>Get help with questions about:</p> | ||
<div> | ||
<div role="list" className="vads-u-padding-bottom--3"> | ||
<li> | ||
<a href="/resources/signing-in-to-vagov/">signing in</a> | ||
</li> | ||
<li> | ||
<a href="/resources/verifying-your-identity-on-vagov/"> | ||
verifying your identity | ||
</a> | ||
</li> | ||
<li> | ||
<a href="/resources/verifying-your-identity-on-vagov/"> | ||
deleting your account | ||
</a> | ||
</li> | ||
</div> | ||
</div> | ||
<va-link | ||
text="The My HealtheVet sign-in option is no loner available" | ||
label="The My HealtheVet sign-in option is no longer available" | ||
href="/" | ||
className="vads-u-margin-top--3" | ||
/> | ||
</div> | ||
) : ( | ||
<p> | ||
Get answers to common{' '} | ||
<a href="/resources/signing-in-to-vagov/"> | ||
questions about signing in | ||
</a>{' '} | ||
and{' '} | ||
<a href="/resources/verifying-your-identity-on-vagov/"> | ||
verifying your identity | ||
</a> | ||
. | ||
</p> | ||
)} | ||
<p> | ||
<SubmitSignInForm startSentence /> We're here 24/7. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
); | ||
}; |
38 changes: 23 additions & 15 deletions
38
src/platform/user/tests/authentication/components/LoginInfo.unit.spec.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 |
---|---|---|
@@ -1,25 +1,33 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { expect } from 'chai'; | ||
import { renderInReduxProvider } from 'platform/testing/unit/react-testing-library-helpers'; | ||
import LoginInfo from 'platform/user/authentication/components/LoginInfo'; | ||
|
||
describe('LoginInfo', () => { | ||
it('renders SubmitSignInForm component', () => { | ||
const wrapper = shallow(<LoginInfo />); | ||
expect(wrapper.find('SubmitSignInForm').exists()).to.be.true; | ||
expect(wrapper.find('SubmitSignInForm').prop('startSentence')).to.be.true; | ||
wrapper.unmount(); | ||
it('renders 4 links when toggle is off', () => { | ||
const { container } = renderInReduxProvider(<LoginInfo />, { | ||
initialState: { | ||
featureToggles: { | ||
// eslint-disable-next-line camelcase | ||
mhv_credential_button_disabled: false, | ||
}, | ||
}, | ||
}); | ||
const links = container.querySelectorAll('a'); | ||
expect(links.length).to.eql(4); | ||
}); | ||
it('anchor tags send users to appropriate place', () => { | ||
const wrapper = shallow(<LoginInfo />); | ||
|
||
const signInTag = wrapper.find('a').at(0); | ||
const verifyIdentityTag = wrapper.find('a').at(1); | ||
it('renders 5 links when toggle is on', () => { | ||
const { container } = renderInReduxProvider(<LoginInfo />, { | ||
initialState: { | ||
featureToggles: { | ||
// eslint-disable-next-line camelcase | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint disabled here |
||
mhv_credential_button_disabled: true, | ||
}, | ||
}, | ||
}); | ||
|
||
expect(signInTag.prop('href')).to.eql('/resources/signing-in-to-vagov/'); | ||
expect(verifyIdentityTag.prop('href')).to.eql( | ||
'/resources/verifying-your-identity-on-vagov/', | ||
); | ||
wrapper.unmount(); | ||
const links = container.querySelectorAll('a'); | ||
expect(links.length).to.eq(5); | ||
}); | ||
}); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint disabled here