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-2966] More JSX conversions #2475

Merged
merged 15 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 82 additions & 82 deletions cypress/component/MultiDatasetVoteTab/datasets_requested.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 2, 3, 4, 5, 6, 7]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 0);
cy.get('[datacy=dataset-count]').should('contain.text', '(0)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 0);
cy.get('[data-cy=dataset-count]').should('contain.text', '(0)');
});

it('Renders no dataset information if bucketDatasets is null', function () {
Expand All @@ -39,8 +39,8 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 2, 3, 4, 5, 6, 7]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 0);
cy.get('[datacy=dataset-count]').should('contain.text', '(0)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 0);
cy.get('[data-cy=dataset-count]').should('contain.text', '(0)');
});

it('Renders no dataset information if dacDatasetIds is empty', function () {
Expand All @@ -50,8 +50,8 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 0);
cy.get('[datacy=dataset-count]').should('contain.text', '(0)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 0);
cy.get('[data-cy=dataset-count]').should('contain.text', '(0)');
});

it('Renders no dataset information if dacDatasetIds is null', function () {
Expand All @@ -60,8 +60,8 @@ describe('DatasetsRequestedPanel - Tests', function () {
bucketDatasets={bucketDatasets}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 0);
cy.get('[datacy=dataset-count]').should('contain.text', '(0)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 0);
cy.get('[data-cy=dataset-count]').should('contain.text', '(0)');
});

it('Renders no dataset information if there are no matches between bucket datasets and DAC dataset ids', function () {
Expand All @@ -71,8 +71,8 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[8, 9, 10]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 0);
cy.get('[datacy=dataset-count]').should('contain.text', '(0)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 0);
cy.get('[data-cy=dataset-count]').should('contain.text', '(0)');
});

it('Renders less than five datasets without an expansion link', function () {
Expand All @@ -82,15 +82,15 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 3, 9, 10]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 2);
cy.get('[datacy=dataset-count]').should('contain.text', '(2)');
cy.get('[data-cy=dataset-list]').children().should('have.length', 2);
cy.get('[data-cy=dataset-count]').should('contain.text', '(2)');

cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 3');

cy.get('[datacy=collapse-expand-link]').should('not.exist');
cy.get('[data-cy=collapse-expand-link]').should('not.exist');
});

it('Renders five datasets without an expansion link', function () {
Expand All @@ -100,21 +100,21 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 2, 3, 4, 5]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 5);
cy.get('[datacy=dataset-count]').should('contain.text', '(5)');

cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-2');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 2');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 3');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-4');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 4');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-5');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 5');

cy.get('[datacy=collapse-expand-link]').should('not.exist');
cy.get('[data-cy=dataset-list]').children().should('have.length', 5);
cy.get('[data-cy=dataset-count]').should('contain.text', '(5)');

cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-2');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 2');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-4');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 4');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-5');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 5');

cy.get('[data-cy=collapse-expand-link]').should('not.exist');
});

it('Renders more than five datasets with an expansion link', function () {
Expand All @@ -124,26 +124,26 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 2, 3, 4, 5, 6, 7]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 5);
cy.get('[datacy=dataset-count]').should('contain.text', '(7)');

cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-2');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 2');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 3');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-4');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 4');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-5');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 5');

cy.get('[datacy=dataset-list]').should('not.contain.text', 'DUOS-6');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'Dataset 6');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'DUOS-7');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'Dataset 7');

cy.get('[datacy=collapse-expand-link]').should('contain.text', '+ View 2 more');
cy.get('[data-cy=dataset-list]').children().should('have.length', 5);
cy.get('[data-cy=dataset-count]').should('contain.text', '(7)');

cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-2');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 2');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 3');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-4');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 4');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-5');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 5');

cy.get('[data-cy=dataset-list]').should('not.contain.text', 'DUOS-6');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'Dataset 6');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'DUOS-7');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'Dataset 7');

cy.get('[data-cy=collapse-expand-link]').should('contain.text', '+ View 2 more');
});

it('Shows more or less datasets when link is clicked', function () {
Expand All @@ -153,28 +153,28 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1, 2, 3, 4, 5, 6, 7]}
/>
);
cy.get('[datacy=dataset-list]').children().should('have.length', 5);
cy.get('[datacy=dataset-count]').should('contain.text', '(7)');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'DUOS-6');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'Dataset 6');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'DUOS-7');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'Dataset 7');

cy.get('[datacy=collapse-expand-link]').should('contain.text', '+ View 2 more');
cy.get('[datacy=collapse-expand-link]').click();

cy.get('[datacy=dataset-list]').children().should('have.length', 7);
cy.get('[datacy=dataset-count]').should('contain.text', '(7)');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-6');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 6');
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-7');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 7');

cy.get('[datacy=collapse-expand-link]').should('contain.text', '- View 2 less');
cy.get('[datacy=collapse-expand-link]').click();

cy.get('[datacy=dataset-list]').children().should('have.length', 5);
cy.get('[datacy=collapse-expand-link]').should('contain.text', '+ View 2 more');
cy.get('[data-cy=dataset-list]').children().should('have.length', 5);
cy.get('[data-cy=dataset-count]').should('contain.text', '(7)');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'DUOS-6');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'Dataset 6');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'DUOS-7');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'Dataset 7');

cy.get('[data-cy=collapse-expand-link]').should('contain.text', '+ View 2 more');
cy.get('[data-cy=collapse-expand-link]').click();

cy.get('[data-cy=dataset-list]').children().should('have.length', 7);
cy.get('[data-cy=dataset-count]').should('contain.text', '(7)');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-6');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 6');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-7');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 7');

cy.get('[data-cy=collapse-expand-link]').should('contain.text', '- View 2 less');
cy.get('[data-cy=collapse-expand-link]').click();

cy.get('[data-cy=dataset-list]').children().should('have.length', 5);
cy.get('[data-cy=collapse-expand-link]').should('contain.text', '+ View 2 more');
});

it('Renders filler dataset identifier if attribute is null', function () {
Expand All @@ -189,9 +189,9 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1]}
/>
);
cy.get('[datacy=dataset-list]').should('not.contain.text', 'DUOS-1');
cy.get('[datacy=dataset-list]').should('contain.text', '- -');
cy.get('[datacy=dataset-list]').should('contain.text', 'Dataset 1');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'DUOS-1');
cy.get('[data-cy=dataset-list]').should('contain.text', '- -');
cy.get('[data-cy=dataset-list]').should('contain.text', 'Dataset 1');
});

it('Renders filler dataset name if attribute is null', function () {
Expand All @@ -206,9 +206,9 @@ describe('DatasetsRequestedPanel - Tests', function () {
dacDatasetIds={[1]}
/>
);
cy.get('[datacy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[datacy=dataset-list]').should('not.contain.text', 'Dataset 1');
cy.get('[datacy=dataset-list]').should('contain.text', '- -');
cy.get('[data-cy=dataset-list]').should('contain.text', 'DUOS-1');
cy.get('[data-cy=dataset-list]').should('not.contain.text', 'Dataset 1');
cy.get('[data-cy=dataset-list]').should('contain.text', '- -');
});

it('Renders skeleton text when loading', function () {
Expand All @@ -221,7 +221,7 @@ describe('DatasetsRequestedPanel - Tests', function () {
);

cy.get('.text-placeholder').should('exist');
cy.get('[datacy=dataset-list]').should('not.exist');
cy.get('[data-cy=dataset-list]').should('not.exist');
});

it('shows all datasets if the viewing on the admin page', () => {
Expand All @@ -234,6 +234,6 @@ describe('DatasetsRequestedPanel - Tests', function () {
/>
);
cy.get('.dataset-list-item').should('have.length', 5);
cy.get('[datacy=collapse-expand-link]').contains('View 2 more');
cy.get('[data-cy=collapse-expand-link]').contains('View 2 more');
});
});
5 changes: 2 additions & 3 deletions src/Routes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {mergeAll} from 'lodash/fp';
import React from 'react';
import {Route, Switch} from 'react-router-dom';
import AuthenticatedRoute from './components/AuthenticatedRoute';
Expand All @@ -21,7 +20,7 @@ import SigningOfficialDarRequests from './pages/signing_official_console/Signing
import SigningOfficialDataSubmitters from './pages/signing_official_console/SigningOfficialDataSubmitters';
import Translator from './pages/Translator';
import NIHPilotInfo from './pages/NIHPilotInfo';
import {Status} from './pages/Status';
import Status from './pages/Status';
import BackgroundSignIn from './pages/BackgroundSignIn';
import ConsentTextGenerator from './pages/ConsentTextGenerator';
import AdminManageInstitutions from './pages/AdminManageInstitutions';
Expand Down Expand Up @@ -49,7 +48,7 @@ const Routes = (props) => (
<Switch>
<Route exact path="/" render={(routeProps) => <Home {...routeProps} {...props} />} />
<Route exact path="/home" render={(routeProps) => <Home {...routeProps} {...props} />} />
<Route exact path="/status" render={(routeProps) => Status(mergeAll([routeProps, props]))} />
<Route exact path="/status" render={(routeProps) => <Status {...routeProps} {...props} />} />
<Route exact path="/liveness" component={HealthCheck} />
<Route exact path="/backgroundsignin" render={
(routeProps) =>
Expand Down
17 changes: 8 additions & 9 deletions src/components/SearchBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { input } from 'react-hyperscript-helpers';
import ReactTooltip from 'react-tooltip';
import './SearchBox.css';

Expand Down Expand Up @@ -28,21 +27,21 @@ export class SearchBox extends Component {

render() {
return (
input({
type: 'text',
placeholder: 'Enter search terms',
onChange: this.changeHandler,
ref: this.myRef,
style: {
<input
type="text"
placeholder="Enter search terms"
onChange={this.changeHandler}
ref={this.myRef}
style={{
width: '100%',
border: '1px solid #cecece',
backgroundColor: '#f3f6f7',
borderRadius: '5px',
height: '4rem',
paddingLeft: '2%',
fontFamily: 'Montserrat'
}
})
}}
/>
);
}
}
Expand Down
Loading
Loading