Skip to content

Commit

Permalink
UIIN-2477 Inventory search/browse: Do not retain checkbox selections …
Browse files Browse the repository at this point in the history
…when toggling search segment.
  • Loading branch information
BogdanDenis committed Nov 1, 2023
1 parent 9fcfe3e commit 88c45fa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
## [11.0.0] IN PROGRESS

* *BREAKING* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636.

## [10.1.0] IN PROGRESS

* Make Inventory search and browse query boxes expandable. Refs UIIN-2493.
* Added support for `containsAny` match option in Advanced search. Refs UIIN-2486.
* Inventory search/browse: Do not retain checkbox selections when toggling search segment. Refs UIIN-2477.

## [10.0.1] IN PROGRESS

Expand Down
7 changes: 6 additions & 1 deletion src/components/InstancesList/InstancesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ class InstancesList extends React.Component {
document.getElementById('input-inventory-search').focus();
}

handleSearchSegmentChange = (segment) => {
this.refocusOnInputSearch(segment);
this.setState({ selectedRows: {} });
}

onSearchModeSwitch = () => {
const {
namespace,
Expand All @@ -415,7 +420,7 @@ class InstancesList extends React.Component {
/>
<FilterNavigation
segment={this.props.segment}
onChange={this.refocusOnInputSearch}
onChange={this.handleSearchSegmentChange}
/>
</>
);
Expand Down
16 changes: 16 additions & 0 deletions src/components/InstancesList/InstancesList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,22 @@ describe('InstancesList', () => {
});
});

describe('when search segment is changed', () => {
it('should clear selected rows', () => {
const {
getAllByLabelText,
getByText,
} = renderInstancesList({
segment: 'instances',
});

fireEvent.click(getAllByLabelText('Select instance')[0]);
fireEvent.click(getByText('Holdings'));

expect(getAllByLabelText('Select instance')[0].checked).toBeFalsy();
});
});

describe('when a user performs a search and clicks the `Next` button in the list of records', () => {
describe('then clicks on the `Browse` lookup tab and then clicks `Search` lookup tab', () => {
it('should avoid infinity loading by resetting the records on unmounting', () => {
Expand Down

0 comments on commit 88c45fa

Please sign in to comment.