Magic Search filter facet removal fix
When there is a text search and a filter facet applied together, deleting the filter facet makes the remaining text search ignored. This patch fixes it, calling text search if text facet remains. Closes-Bug: #1930929 Change-Id: I343dc4220d572669a1b36ed9cf2d10d4dacf7166
This commit is contained in:
parent
6071b622b2
commit
ca429efbd8
@ -334,6 +334,10 @@
|
||||
delete ctrl.textSearch;
|
||||
} else {
|
||||
$scope.$emit(magicSearchEvents.SEARCH_UPDATED, query);
|
||||
if (angular.isDefined(ctrl.textSearch)) {
|
||||
// emit text search if text facet remains
|
||||
emitTextSearch(ctrl.textSearch || '');
|
||||
}
|
||||
if (ctrl.currentSearch.length > 0) {
|
||||
// prune facets as needed from menus
|
||||
var newFacet = ctrl.currentSearch[ctrl.currentSearch.length - 1].name;
|
||||
|
@ -509,6 +509,14 @@
|
||||
expect(scope.strings.prompt).toEqual('');
|
||||
});
|
||||
|
||||
it("emits textSearch if text facet remains", function() {
|
||||
spyOn(scope, '$emit');
|
||||
ctrl.currentSearch = [{}];
|
||||
ctrl.textSearch = 'cat';
|
||||
ctrl.removeFacet(0);
|
||||
expect(scope.$emit).toHaveBeenCalledWith(magicSearchEvents.TEXT_SEARCH, 'cat', undefined);
|
||||
});
|
||||
|
||||
it("resets state if facet selected", function() {
|
||||
ctrl.currentSearch = [{}];
|
||||
ctrl.facetSelected = {};
|
||||
|
Loading…
Reference in New Issue
Block a user