Skip to content

Commit

Permalink
[DUOS-2860] Remove duplicate display of profile and lc warning in DAR…
Browse files Browse the repository at this point in the history
… form (#2444)
  • Loading branch information
aarohinadkarni authored Jan 31, 2024
1 parent 160e204 commit cbb44be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
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

0 comments on commit cbb44be

Please sign in to comment.