diff --git a/addons/web/static/src/js/views/control_panel/control_panel_renderer.js b/addons/web/static/src/js/views/control_panel/control_panel_renderer.js index 9c519695d7d..677f0733bc5 100644 --- a/addons/web/static/src/js/views/control_panel/control_panel_renderer.js +++ b/addons/web/static/src/js/views/control_panel/control_panel_renderer.js @@ -292,9 +292,7 @@ var ControlPanelRenderer = Renderer.extend({ context: this.context, facets: this.state.facets, fields: this.state.fields, - filters: this.state.filters, filterFields: this.state.filterFields, - groupBys: this.state.groupBys, }); return this.searchBar.appendTo(this.$('.o_searchview')).then(function () { if (oldSearchBar) { diff --git a/addons/web/static/src/js/views/control_panel/search/search_bar.js b/addons/web/static/src/js/views/control_panel/search/search_bar.js index d4efab663d4..3f58fcdce2a 100644 --- a/addons/web/static/src/js/views/control_panel/search/search_bar.js +++ b/addons/web/static/src/js/views/control_panel/search/search_bar.js @@ -28,9 +28,7 @@ var SearchBar = Widget.extend({ this.facets = params.facets; this.fields = params.fields; - this.filters = params.filters; this.filterFields = params.filterFields; - this.groupBys = params.groupBys; this.autoCompleteSources = []; this.searchFacets = []; @@ -167,12 +165,6 @@ var SearchBar = Widget.extend({ self.autoCompleteSources.push(new (Obj) (self, filter, field, self.context)); } }); - _.each(this.filters, function (filter) { - self.autoCompleteSources.push(new (registry.get('filter'))(self, filter)); - }); - _.each(this.groupBys, function (filter) { - self.autoCompleteSources.push(new (registry.get('groupby'))(self, filter)); - }); }, //-------------------------------------------------------------------------- diff --git a/addons/web/static/src/scss/search_view.scss b/addons/web/static/src/scss/search_view.scss index 22baf6d0a0e..e2f44fbf88f 100644 --- a/addons/web/static/src/scss/search_view.scss +++ b/addons/web/static/src/scss/search_view.scss @@ -82,7 +82,6 @@ } &.o-expand, &.o-expanded { // caret @include o-position-absolute($left: 6px); - padding: 3px; } &.o-expand:before { @include o-caret-right; diff --git a/addons/web/static/tests/views/search_view_tests.js b/addons/web/static/tests/views/search_view_tests.js index 60b6fdef644..bd75f92811b 100644 --- a/addons/web/static/tests/views/search_view_tests.js +++ b/addons/web/static/tests/views/search_view_tests.js @@ -1265,56 +1265,36 @@ QUnit.module('Search View', { QUnit.module('Autocompletion'); - QUnit.test('selection via autocompletion and deletion modifies appropriately submenus', async function (assert) { - assert.expect(6); + QUnit.test('select an autocomplete field', async function (assert) { + assert.expect(3); + var searchRead = 0; var actionManager = await createActionManager({ actions: this.actions, archs: this.archs, data: this.data, + mockRPC: function (route, args) { + if (route === '/web/dataset/search_read') { + if (searchRead === 1) { + assert.deepEqual(args.domain, [["foo", "ilike", "a"]]); + } + searchRead++; + } + return this._super.apply(this, arguments); + }, }); - const unpatchDate = patchDate(2019,6,31,13,43,0); - - await actionManager.doAction(9); + await actionManager.doAction(11); await testUtils.fields.triggerKey('press', $('.o_searchview_input'), 97); - await testUtils.fields.triggerKey('up', $('.o_searchview_input'), 'enter'); - await testUtils.fields.triggerKey('press', $('.o_searchview_input'), 103); - await testUtils.fields.triggerKey('up', $('.o_searchview_input'), 'enter'); + assert.strictEqual(actionManager.$('.o_searchview_autocomplete li').length, 2, + "there should be 2 result for 'a' in search bar autocomplete"); + await testUtils.fields.triggerKey('up', $('.o_searchview_input'), 'enter'); assert.strictEqual($('.o_searchview_input_container .o_facet_values').eq(0).text().trim(), - "Date Field Filter: July 2019", - "There should be a filter facet with label 'Date Field Filter: July 2019'"); - assert.strictEqual($('.o_searchview_input_container .o_facet_values').eq(1).text().trim(), - "Date Field Groupby: Day", - "There should be a filter facet with label 'Date Field Groupby: Day'"); - - await testUtils.dom.click($('button .fa-filter')); - await testUtils.dom.click($('.o_filters_menu .o_menu_item').eq(0)); - assert.strictEqual($('.o_filters_menu .o_item_option a.selected').text().trim(), "July2019", - "The item 'July 2019' should be selected in the filters menu"); - - await testUtils.dom.click($('button .fa-bars')); - await testUtils.dom.click($('.o_group_by_menu .o_menu_item').eq(0)); - assert.strictEqual($('.o_group_by_menu .o_item_option a.selected').text().trim(), "Day", - "The item 'Day' should be selected in the groupby menu"); - - await testUtils.dom.click($('div .o_searchview_facet .o_facet_remove').eq(0)); - await testUtils.dom.click($('div .o_searchview_facet .o_facet_remove').eq(0)); - - await testUtils.dom.click($('button .fa-filter')); - await testUtils.dom.click($('.o_filters_menu .o_menu_item').eq(0)); - assert.containsNone($('.o_filters_menu .o_item_option a.selected'), - "The item 'This Month' should have unselected in the filters menu"); - - await testUtils.dom.click($('button .fa-bars')); - await testUtils.dom.click($('.o_group_by_menu .o_menu_item').eq(0)); - assert.containsNone($('.o_group_by_menu .o_item_option a.selected'), - "The item 'Day' should have been unselected in the groupby menu"); + "a", "There should be a field facet with label 'a'"); actionManager.destroy(); - unpatchDate(); }); QUnit.test('select an autocomplete field with `context` key', async function (assert) {