Skip to content
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

[DUOS-2860] Remove duplicate display of profile and lc warning in DAR form #2444

7 changes: 2 additions & 5 deletions cypress/component/DataAccessRequest/researcher_info.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,22 @@ describe('Researcher Info', () => {
it('renders the missing library cards alert correctly', () => {
const mergedProps = {...props, ...{formData: {...props.formData }}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-missing-library-cards]').should('be.visible');
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('not.exist');
cy.get('[dataCy=researcher-info-profile-submitted]').should('not.exist');
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
});

it('renders the profile submitted alert', () => {
const mergedProps = {...props, ...{completed: true, researcher: researcherWithLibraryCards}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('not.exist');
cy.get('[dataCy=researcher-info-missing-library-cards]').should('not.exist');
});

it('renders the profile unsubmitted alert', () => {
const mergedProps = {...props, ...{completed: false, researcher: researcherWithLibraryCards}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('be.visible');
cy.get('[dataCy=researcher-info-profile-submitted]').should('not.exist');
cy.get('[dataCy=researcher-info-missing-library-cards]').should('not.exist');
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
});

it('renders the internal lab staff button and form', () => {
Expand Down
12 changes: 3 additions & 9 deletions src/pages/dar_application/ResearcherInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const profileLink = h(Link, {to:'/profile', style: linkStyle}, ['Your Profile'])
const profileUnsubmitted = span(['Please submit ', profileLink, ' to be able to create a Data Access Request']);
const profileSubmitted = span(['Please make sure ', profileLink, ' is updated as it will be used to pre-populate parts of the Data Access Request']);
const libraryCardLink = a({href: 'https://broad-duos.zendesk.com/hc/en-us/articles/4402736994971-Researcher-FAQs', style: linkStyle, target: '_blank'}, ['Library Card']);
const missingLibraryCard = span(['You must submit ', profileLink, ' and obtain a ', libraryCardLink, ' from your Signing Official before you can submit a Data Access Request']);

export default function ResearcherInfo(props) {
const {
Expand Down Expand Up @@ -58,11 +57,11 @@ export default function ResearcherInfo(props) {
div({ className: 'dar-step-card' }, [
div({
datacy: 'researcher-info-profile-submitted',
isRendered: (completed === false && libraryCardReqSatisfied === false), className: 'rp-alert' }, [
isRendered: (completed === false || libraryCardReqSatisfied === false)}, [
!readOnlyMode && Alert({
id: 'profileSubmitted',
type: 'important',
title: span([
type: 'danger',
title: span({ className: 'errored' }, [
`You must submit `, profileLink, ` and obtain a `, libraryCardLink,
` from your Signing official before you can submit a Data Access Request.`
])
Expand Down Expand Up @@ -103,11 +102,6 @@ export default function ResearcherInfo(props) {
})
]),
fieldset({ }, [
div({
datacy: 'researcher-info-missing-library-cards',
isRendered: libraryCardReqSatisfied === false, className: 'rp-alert' }, [
!readOnlyMode && Alert({ id: 'missingLibraryCard', type: 'danger', title: missingLibraryCard })
]),
div({
datacy: 'researcher-info-profile-unsubmitted',
isRendered: (completed === false && libraryCardReqSatisfied === true), className: 'rp-alert' }, [
Expand Down
Loading