Commit 026fe78e authored by Zack Cuddy's avatar Zack Cuddy Committed by Andrew Fontaine

Global Search - Fix reset filters button

parent 483126f9
......@@ -13,9 +13,9 @@ export default {
ConfidentialityFilter,
},
computed: {
...mapState(['query', 'sidebarDirty']),
...mapState(['urlQuery', 'sidebarDirty']),
showReset() {
return this.query.state || this.query.confidential;
return this.urlQuery.state || this.urlQuery.confidential;
},
},
methods: {
......
......@@ -20,7 +20,7 @@ describe('GlobalSearchSidebar', () => {
const createComponent = (initialState) => {
const store = new Vuex.Store({
state: {
query: MOCK_QUERY,
urlQuery: MOCK_QUERY,
...initialState,
},
actions: actionSpies,
......@@ -84,7 +84,7 @@ describe('GlobalSearchSidebar', () => {
describe('ResetLinkButton', () => {
describe('with no filter selected', () => {
beforeEach(() => {
createComponent({ query: {} });
createComponent({ urlQuery: {} });
});
it('does not render', () => {
......@@ -94,10 +94,20 @@ describe('GlobalSearchSidebar', () => {
describe('with filter selected', () => {
beforeEach(() => {
createComponent();
createComponent({ urlQuery: MOCK_QUERY });
});
it('does render', () => {
expect(findResetLinkButton().exists()).toBe(true);
});
});
describe('with filter selected and user updated query back to default', () => {
beforeEach(() => {
createComponent({ urlQuery: MOCK_QUERY, query: {} });
});
it('does render when a filter selected', () => {
it('does render', () => {
expect(findResetLinkButton().exists()).toBe(true);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment