Skip to content

Commit 4a99079

Browse files
UIREQMED-44: Persist filters when changing between actions
1 parent 6968fd9 commit 4a99079

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/components/NavigationMenu/NavigationMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const handleChangeMenu = (event, location, history) => {
5757
if (pathname === getMediatedRequestsActivitiesUrl()) {
5858
destination.search = location.state;
5959
} else {
60-
destination.state = location.search;
60+
destination.state = location.search ? location.search : destination.state;
6161
}
6262

6363
history.push(destination);

src/components/NavigationMenu/NavigationMenu.test.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe('NavigationMenu', () => {
133133
}));
134134
});
135135

136-
it('should handle correct when pathname not equal mediated requests activities', () => {
136+
it('should handle correct when pathname not equal mediated requests activities with empty search', () => {
137137
const event = {
138138
target: {
139139
value: getConfirmItemArrivalUrl(),
@@ -155,5 +155,28 @@ describe('NavigationMenu', () => {
155155
pathname: getConfirmItemArrivalUrl(),
156156
}));
157157
});
158+
159+
it('should handle correct when pathname not equal mediated requests activities with not empty search', () => {
160+
const event = {
161+
target: {
162+
value: getConfirmItemArrivalUrl(),
163+
},
164+
};
165+
const location = {
166+
pathname: getMediatedRequestsActivitiesUrl(),
167+
state: '',
168+
search: '?query=Test',
169+
};
170+
const history = {
171+
location,
172+
push,
173+
};
174+
175+
handleChangeMenu(event, location, history);
176+
177+
expect(push).toHaveBeenCalledWith(expect.objectContaining({
178+
pathname: getConfirmItemArrivalUrl(),
179+
}));
180+
});
158181
});
159182
});

0 commit comments

Comments
 (0)