Skip to content

Commit

Permalink
PR feedback: reset search query on flyout re-open
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Mar 18, 2021
1 parent f232aec commit 6c559ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ describe('AddResultLogic', () => {

describe('actions', () => {
describe('openFlyout', () => {
it('sets isFlyoutOpen to true', () => {
mount({ isFlyoutOpen: false });
it('sets isFlyoutOpen to true and resets the searchQuery term', () => {
mount({ isFlyoutOpen: false, searchQuery: 'a previous search' });

AddResultLogic.actions.openFlyout();

expect(AddResultLogic.values).toEqual({
...DEFAULT_VALUES,
isFlyoutOpen: true,
searchQuery: '',
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const AddResultLogic = kea<MakeLogicType<AddResultValues, AddResultAction
'',
{
search: (_, { query }) => query,
openFlyout: () => '',
},
],
searchResults: [
Expand Down

0 comments on commit 6c559ac

Please sign in to comment.