mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-3742] Bug Fixes for new Layout (#3149)
* Bug Fixes * Bug Fixes * Bug Fixes * Bug Fixes * implemented review comments * ACS-3742 Renamed title --------- Co-authored-by: Aleksander Sklorz <Aleksander.Sklorz@hyland.com>
This commit is contained in:
@@ -28,10 +28,11 @@ import { SearchInputComponent } from './search-input.component';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { SearchByTermAction, SearchActionTypes, SnackbarErrorAction, SnackbarActionTypes } from '@alfresco/aca-shared/store';
|
||||
import { AppHookService } from '@alfresco/aca-shared';
|
||||
import { AppHookService, AppService } from '@alfresco/aca-shared';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { SearchNavigationService } from '../search-navigation.service';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
|
||||
describe('SearchInputComponent', () => {
|
||||
let fixture: ComponentFixture<SearchInputComponent>;
|
||||
@@ -39,12 +40,22 @@ describe('SearchInputComponent', () => {
|
||||
let actions$: Actions;
|
||||
let appHookService: AppHookService;
|
||||
let searchInputService: SearchNavigationService;
|
||||
const appServiceMock = {
|
||||
appNavNarMode$: new BehaviorSubject('collapsed'),
|
||||
toggleAppNavBar$: new Subject()
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
declarations: [SearchInputComponent],
|
||||
providers: [SearchQueryBuilderService],
|
||||
providers: [
|
||||
{
|
||||
provide: AppService,
|
||||
useValue: appServiceMock
|
||||
},
|
||||
SearchQueryBuilderService
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
@@ -59,6 +70,13 @@ describe('SearchInputComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should collapsed sidenav by default', () => {
|
||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
||||
component.ngOnInit();
|
||||
|
||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('collapsed');
|
||||
});
|
||||
|
||||
it('should change flag on library400Error event', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -225,4 +243,11 @@ describe('SearchInputComponent', () => {
|
||||
expect(searchInputService.navigateBack).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
it('should sidenav expanded after the component is destroy', () => {
|
||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
||||
component.ngOnDestroy();
|
||||
|
||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('expanded');
|
||||
});
|
||||
});
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppHookService } from '@alfresco/aca-shared';
|
||||
import { AppHookService, AppService } from '@alfresco/aca-shared';
|
||||
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
@@ -86,6 +86,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
||||
private router: Router,
|
||||
private store: Store<AppStore>,
|
||||
private appHookService: AppHookService,
|
||||
private appService: AppService,
|
||||
public searchInputService: SearchNavigationService
|
||||
) {
|
||||
this.searchOnChange = this.config.get<boolean>('search.aca:triggeredOnChange', true);
|
||||
@@ -113,6 +114,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
showInputValue() {
|
||||
this.appService.appNavNarMode$.next('collapsed');
|
||||
this.has400LibraryError = false;
|
||||
this.searchedWord = this.getUrlSearchTerm();
|
||||
|
||||
@@ -122,6 +124,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.appService.appNavNarMode$.next('expanded');
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
this.removeContentFilters();
|
||||
|
@@ -29,19 +29,31 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { SearchLibrariesResultsComponent } from './search-libraries-results.component';
|
||||
import { SearchLibrariesQueryBuilderService } from './search-libraries-query-builder.service';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AppService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('SearchLibrariesResultsComponent', () => {
|
||||
let component: SearchLibrariesResultsComponent;
|
||||
let fixture: ComponentFixture<SearchLibrariesResultsComponent>;
|
||||
|
||||
const emptyPage = { list: { pagination: { totalItems: 0 }, entries: [] } };
|
||||
const appServiceMock = {
|
||||
appNavNarMode$: new BehaviorSubject('collapsed'),
|
||||
toggleAppNavBar$: new Subject()
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule, AppConfigModule],
|
||||
declarations: [DataTableComponent, DocumentListComponent, SearchLibrariesResultsComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
providers: [SearchLibrariesQueryBuilderService]
|
||||
providers: [
|
||||
{
|
||||
provide: AppService,
|
||||
useValue: appServiceMock
|
||||
},
|
||||
SearchLibrariesQueryBuilderService
|
||||
]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(SearchLibrariesResultsComponent);
|
||||
@@ -54,4 +66,11 @@ describe('SearchLibrariesResultsComponent', () => {
|
||||
|
||||
expect(component.onSearchResultLoaded).toHaveBeenCalledWith(emptyPage);
|
||||
});
|
||||
|
||||
it('should collapsed sidenav by default', () => {
|
||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
||||
component.ngOnInit();
|
||||
|
||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('collapsed');
|
||||
});
|
||||
});
|
||||
|
@@ -30,7 +30,7 @@ import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { SearchLibrariesQueryBuilderService } from './search-libraries-query-builder.service';
|
||||
import { AppExtensionService, AppHookService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService, AppHookService, AppService, PageComponent } from '@alfresco/aca-shared';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
@@ -52,6 +52,7 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
||||
private librariesQueryBuilder: SearchLibrariesQueryBuilderService,
|
||||
private route: ActivatedRoute,
|
||||
private appHookService: AppHookService,
|
||||
private appService: AppService,
|
||||
store: Store<AppStore>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService
|
||||
@@ -65,6 +66,7 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.appService.appNavNarMode$.next('collapsed');
|
||||
super.ngOnInit();
|
||||
|
||||
this.columns = this.extensions.documentListPresets.searchLibraries || [];
|
||||
|
@@ -62,4 +62,12 @@ describe('SearchNavigationService', () => {
|
||||
|
||||
expect(routerNavigate).toHaveBeenCalledWith(['/search']);
|
||||
});
|
||||
|
||||
it('should navigate back to the previous route when call the navigateBack function', () => {
|
||||
const routerNavigate = spyOn(router, 'navigate');
|
||||
service.saveRoute('');
|
||||
service.navigateBack();
|
||||
|
||||
expect(routerNavigate).toHaveBeenCalledWith(['/personal-files']);
|
||||
});
|
||||
});
|
||||
|
@@ -44,6 +44,8 @@ export class SearchNavigationService {
|
||||
navigateBack(): void {
|
||||
if (this.previousRoute) {
|
||||
this.router.navigate([this.previousRoute]);
|
||||
} else {
|
||||
this.router.navigate(['/personal-files']);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user