[ACA-3541] show error message on empty search (#2164)

* [ACA-3541] User is not able to reset the search to be able to display the entire list of results

* * fixed lint
This commit is contained in:
Dharan
2021-06-15 10:21:32 +02:00
committed by GitHub
parent c9e2d805c4
commit 9c4eae0b10
3 changed files with 20 additions and 11 deletions
@@ -28,7 +28,7 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { SearchInputComponent } from './search-input.component';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { Actions, ofType } from '@ngrx/effects';
import { SearchByTermAction, SearchActionTypes } from '@alfresco/aca-shared/store';
import { SearchByTermAction, SearchActionTypes, SnackbarErrorAction, SnackbarActionTypes } from '@alfresco/aca-shared/store';
import { AppHookService } from '@alfresco/aca-shared';
import { map } from 'rxjs/operators';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
@@ -139,6 +139,21 @@ describe('SearchInputComponent', () => {
});
component.onSearchChange(searchedTerm);
});
it('should show snack for empty search', (done) => {
const searchedTerm = '';
actions$
.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map((action) => {
expect(action.payload).toBe('APP.BROWSE.SEARCH.EMPTY_SEARCH');
})
)
.subscribe(() => {
done();
});
component.onSearchSubmit(searchedTerm);
});
});
describe('isLibrariesChecked()', () => {
@@ -24,7 +24,7 @@
*/
import { AppHookService } from '@alfresco/aca-shared';
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel } from '@alfresco/aca-shared/store';
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel, SnackbarErrorAction } from '@alfresco/aca-shared/store';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { AppConfigService } from '@alfresco/adf-core';
import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
@@ -136,6 +136,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
this.searchedWord = searchTerm;
this.searchByOption();
} else {
this.store.dispatch(new SnackbarErrorAction('APP.BROWSE.SEARCH.EMPTY_SEARCH'));
}
this.trigger.closeMenu();
}
+1 -9
View File
@@ -178,6 +178,7 @@
},
"UNKNOWN_LOCATION": "Unknown",
"NO_RESULTS": "Your search returned 0 results",
"EMPTY_SEARCH": "Search term required",
"NO_FILTER_RESULTS": "Your filter returned 0 results",
"TOGGLE_SEARCH_FILTER": "Toggle search filter",
"ERRORS": {
@@ -403,15 +404,6 @@
}
}
},
"PERMISSIONS": {
"DIALOG": {
"TITLE": "Manage Permissions",
"CLOSE": "Close",
"INHERIT_PERMISSIONS_BUTTON": "Inherit Permissions",
"INHERITED_PERMISSIONS_BUTTON": "Permissions Inherited",
"ADD_USER_OR_GROUP": "Add User or Group"
}
},
"SHARED_LINK": {
"UNSHARE_PERMISSION_ERROR": "You don't have permission to unshare this file"
},