[DURACOM-303] rename variable, minor code refactor

This commit is contained in:
FrancescoMolinaro
2025-01-13 10:51:53 +01:00
parent 2c28f75263
commit 311f648c3f
6 changed files with 14 additions and 5 deletions

View File

@@ -84,7 +84,7 @@ export class SearchFiltersComponent implements OnInit, OnDestroy {
@Inject(SEARCH_CONFIG_SERVICE) private searchConfigService: SearchConfigurationService,
@Inject(APP_CONFIG) protected appConfig: AppConfig,
) {
this.defaultFilterCount = this.appConfig.search.defaultFiltersCount ?? 5;
this.defaultFilterCount = this.appConfig.search.filterPlaceholdersCount ?? 5;
}
ngOnInit(): void {

View File

@@ -4,6 +4,8 @@ import {
} from '@angular/core/testing';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { SearchService } from '../../../../core/shared/search/search.service';
import { SearchServiceStub } from '../../../testing/search-service.stub';
import { SearchResultsSkeletonComponent } from './search-results-skeleton.component';
describe('SearchResultsSkeletonComponent', () => {
@@ -13,6 +15,9 @@ describe('SearchResultsSkeletonComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SearchResultsSkeletonComponent, NgxSkeletonLoaderModule],
providers: [
{ provide: SearchService, useValue: new SearchServiceStub() },
],
})
.compileComponents();

View File

@@ -42,7 +42,7 @@ export class SearchResultsSkeletonComponent implements OnInit {
protected readonly ViewMode = ViewMode;
constructor(private searchService: SearchService) {
this.viewMode$ = searchService.getViewMode();
this.viewMode$ = this.searchService.getViewMode();
}
ngOnInit() {

View File

@@ -13,6 +13,10 @@ export class SearchConfigurationServiceStub {
return observableOf([]);
}
getCurrentFilters() {
return observableOf([]);
}
getCurrentScope(a) {
return observableOf('test-id');
}

View File

@@ -445,6 +445,6 @@ export class DefaultAppConfig implements AppConfig {
};
search: SearchConfig = {
defaultFilterCount: 5
filterPlaceholdersCount: 5
}
}

View File

@@ -5,8 +5,8 @@ export interface SearchConfig extends Config {
* Number used to render n UI elements called loading skeletons that act as placeholders.
* These elements indicate that some content will be loaded in their stead.
* Since we don't know how many filters will be loaded before we receive a response from the server we use this parameter for the skeletons count.
* For instance f we set 5 then 5 loading skeletons will be visualized before the actual filters are retrieved.
* For instance if we set 5 then 5 loading skeletons will be visualized before the actual filters are retrieved.
*/
defaultFilterCount?: number;
filterPlaceholdersCount?: number;
}