-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates login info component (#34049)
- Loading branch information
Showing
5 changed files
with
124 additions
and
45 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
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 | ||
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); | ||
}); | ||
}); |