Commit 792ec452 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '343281-reset-filters-disappearing' into 'master'

Global Search - Fix reset filters button

See merge request gitlab-org/gitlab!72627
parents d372e6a1 026fe78e
......@@ -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 when a filter selected', () => {
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', () => {
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