Skip to content

Commit

Permalink
Merge pull request #299 from folio-org/UIDATIMP-217
Browse files Browse the repository at this point in the history
UIDATIMP-217: add rowUpdater to fix checkboxes
  • Loading branch information
OleksandrYehorovEPAM authored Sep 10, 2019
2 parents d05a770 + 7d76fed commit 32395ea
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 69 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Add job profile details pane on choose job profile page (UIDATIMP-258)
* Fix file extension validation by making it case insensitive (UIDATIMP-252)
* Add associated job profiles search on action profile details pane (UIDATIMP-217)
* Integrate updated MultiColumnList component (UIDATIMP-276)

## [1.4.0](https://github.com/folio-org/ui-data-import/tree/v1.4.0) (2019-08-02)
* Create data import settings page's 3rd pane for action profiles (UIDATIMP-8)
Expand Down
9 changes: 9 additions & 0 deletions src/components/ListView/ListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class ListView extends Component {
record: null,
hasLoaded: false,
},
checkboxList: {},
};

state = {
Expand Down Expand Up @@ -165,6 +166,12 @@ export class ListView extends Component {
/>
);

rowUpdater = ({ id }) => {
const { checkboxList: { selectedRecords } } = this.props;

return selectedRecords.has(id);
};

render() {
const {
resources,
Expand Down Expand Up @@ -200,6 +207,7 @@ export class ListView extends Component {
const urlQuery = queryString.parse(search);
const searchTerm = trimSearchTerm(urlQuery.query);
const actionMenu = isEmpty(actionMenuItems) ? null : this.renderActionMenu;
const rowUpdater = selectedRecords ? this.rowUpdater : undefined;

return (
<IntlConsumer>
Expand Down Expand Up @@ -246,6 +254,7 @@ export class ListView extends Component {
editRecordInitialValuesAreLoaded={selectedRecord.hasLoaded}
showSingleResult={showSingleResult}
onSubmitSearch={deselectAll}
rowUpdater={rowUpdater}
{...props}
/>
<ConfirmationModal
Expand Down
3 changes: 3 additions & 0 deletions src/components/SearchAndSort/SearchAndSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class SearchAndSort extends Component {
defaultSort: PropTypes.string,
finishedResourceName: PropTypes.string,
fullWidthContainer: PropTypes.instanceOf(Element),
rowUpdater: PropTypes.func,
};

static defaultProps = {
Expand Down Expand Up @@ -616,6 +617,7 @@ export class SearchAndSort extends Component {
visibleColumns,
objectName,
defaultSort,
rowUpdater,
} = this.props;
const { selectedItem } = this.state;

Expand All @@ -639,6 +641,7 @@ export class SearchAndSort extends Component {
contentData={records}
selectedRow={selectedItem}
formatter={resultsFormatter}
rowUpdater={rowUpdater}
visibleColumns={visibleColumns}
sortOrder={sortOrder}
sortDirection={sortDirection}
Expand Down
3 changes: 3 additions & 0 deletions src/settings/ActionProfiles/AssociatedJobProfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ const AssociatedJobProfilesComponent = ({
selectedRecords,
});

const rowUpdater = ({ id }) => selectedRecords.has(id);

return (
<div data-test-associated-job-profiles>
<SearchAndSortQuery
Expand Down Expand Up @@ -169,6 +171,7 @@ const AssociatedJobProfilesComponent = ({
}}
columnWidths={columnWidths}
formatter={associatedJobProfilesFormatter}
rowUpdater={rowUpdater}
sortOrder={sortOrder}
sortDirection={sortDirection}
onHeaderClick={onSort}
Expand Down
7 changes: 7 additions & 0 deletions src/settings/MatchProfiles/ViewMatchProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ export class ViewMatchProfile extends Component {
};
}

rowUpdater = ({ id }) => {
const { checkboxList: { selectedRecords } } = this.props;

return selectedRecords.has(id);
};

render() {
const {
onClose,
Expand Down Expand Up @@ -408,6 +414,7 @@ export class ViewMatchProfile extends Component {
selectRecord,
selectedRecords,
})}
rowUpdater={this.rowUpdater}
/>
</Fragment>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ describe('Action Profile View', () => {
expect(actionProfileDetails.associatedJobProfiles.list.rowCount).to.be.equal(3);
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await actionProfileDetails.associatedJobProfiles.selectAllCheckBox.clickAndBlur();
});
Expand Down Expand Up @@ -152,9 +150,7 @@ describe('Action Profile View', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await actionProfileDetails.associatedJobProfiles.checkBoxes(0).clickAndBlur();
});
Expand Down
16 changes: 4 additions & 12 deletions test/bigtest/tests/action-profiles/action-profiles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ describe('Action profiles', () => {
expect(actionProfiles.list.headers(6).text).to.equal(translation.updatedBy);
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await actionProfiles.selectAllCheckBox.clickAndBlur();
});
Expand All @@ -65,9 +63,7 @@ describe('Action profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await actionProfiles.checkBoxes(0).clickAndBlur();
});
Expand All @@ -87,9 +83,7 @@ describe('Action profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('select all button', () => {
describe('select all button', () => {
beforeEach(async () => {
await actionProfiles.actionMenu.click();
await actionProfiles.actionMenu.selectAllButton.click();
Expand All @@ -102,9 +96,7 @@ describe('Action profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('deselect all button', () => {
describe('deselect all button', () => {
beforeEach(async () => {
await actionProfiles.checkBoxes(0).clickAndBlur();
await actionProfiles.checkBoxes(1).clickAndBlur();
Expand Down
28 changes: 7 additions & 21 deletions test/bigtest/tests/job-profiles/job-profiles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await jobProfiles.selectAllCheckBox.clickAndBlur();
});
Expand All @@ -75,9 +73,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await jobProfiles.checkBoxes(0).clickAndBlur();
});
Expand All @@ -87,9 +83,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('select all checkbox', () => {
describe('select all checkbox', () => {
beforeEach(async () => {
await jobProfiles.selectAllCheckBox.clickAndBlur();
});
Expand Down Expand Up @@ -123,9 +117,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('select all button', () => {
describe('select all button', () => {
beforeEach(async () => {
await jobProfiles.actionMenu.click();
await jobProfiles.actionMenu.selectAllButton.click();
Expand All @@ -138,9 +130,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('deselect all button', () => {
describe('deselect all button', () => {
beforeEach(async () => {
await jobProfiles.checkBoxes(0).clickAndBlur();
await jobProfiles.checkBoxes(1).clickAndBlur();
Expand All @@ -166,9 +156,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('when using search', () => {
describe('when using search', () => {
beforeEach(async () => {
await jobProfiles.checkBoxes(0).clickAndBlur();
await jobProfiles.checkBoxes(1).clickAndBlur();
Expand All @@ -183,9 +171,7 @@ describe('Job profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('when clearing search', () => {
describe('when clearing search', () => {
beforeEach(async () => {
await jobProfiles.searchFiled.fill('acq');
await jobProfiles.searchSubmitButton.click();
Expand Down
8 changes: 2 additions & 6 deletions test/bigtest/tests/mapping-profiles/mapping-profiles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ describe('Mapping profiles', () => {
expect(mappingProfiles.list.headers(5).text).to.equal(translation.updatedBy);
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await mappingProfiles.selectAllCheckBox.clickAndBlur();
});
Expand All @@ -64,9 +62,7 @@ describe('Mapping profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await mappingProfiles.checkBoxes(0).clickAndBlur();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ describe('Match Profile View', () => {
expect(matchProfileDetails.associatedJobProfiles.list.rowCount).to.be.equal(3);
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await matchProfileDetails.associatedJobProfiles.selectAllCheckBox.clickAndBlur();
});
Expand Down Expand Up @@ -99,9 +97,7 @@ describe('Match Profile View', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await matchProfileDetails.associatedJobProfiles.checkBoxes(0).clickAndBlur();
});
Expand Down
24 changes: 6 additions & 18 deletions test/bigtest/tests/match-profiles/match-profiles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select all checkbox', () => {
describe('has select all checkbox', () => {
beforeEach(async () => {
await matchProfiles.selectAllCheckBox.clickAndBlur();
});
Expand All @@ -93,9 +91,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await matchProfiles.checkBoxes(0).clickAndBlur();
});
Expand All @@ -105,9 +101,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('has select individual item checkbox', () => {
describe('has select individual item checkbox', () => {
beforeEach(async () => {
await matchProfiles.checkBoxes(0).clickAndBlur();
});
Expand All @@ -117,9 +111,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('select all checkbox', () => {
describe('select all checkbox', () => {
beforeEach(async () => {
await matchProfiles.selectAllCheckBox.clickAndBlur();
});
Expand Down Expand Up @@ -153,9 +145,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('select all button', () => {
describe('select all button', () => {
beforeEach(async () => {
await matchProfiles.actionMenu.click();
await matchProfiles.actionMenu.selectAllButton.click();
Expand All @@ -168,9 +158,7 @@ describe('Match profiles', () => {
});
});

// TODO: remove `.skip` from checkbox tests when MCL component is fixed
// eslint-disable-next-line no-only-tests/no-only-tests
describe.skip('deselect all button', () => {
describe('deselect all button', () => {
beforeEach(async () => {
await matchProfiles.checkBoxes(0).clickAndBlur();
await matchProfiles.checkBoxes(1).clickAndBlur();
Expand Down

0 comments on commit 32395ea

Please sign in to comment.