mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-2265] fix user preference null value (#2948)
* fix user preference null value * fix method call test public
This commit is contained in:
parent
63a146616b
commit
6e57cd3e17
@ -191,8 +191,8 @@ export class AuthenticationService {
|
|||||||
* The method save the AUTH ticket in the Storage
|
* The method save the AUTH ticket in the Storage
|
||||||
*/
|
*/
|
||||||
saveTicketAuth(): void {
|
saveTicketAuth(): void {
|
||||||
if (this.alfrescoApi.getInstance() && (<any>this.alfrescoApi.getInstance()).getTicketAuth()) {
|
if (this.alfrescoApi.getInstance() && (<any> this.alfrescoApi.getInstance()).getTicketAuth()) {
|
||||||
this.storage.setItem('ticket-AUTH', (<any>this.alfrescoApi.getInstance()).getTicketAuth());
|
this.storage.setItem('ticket-AUTH', (<any> this.alfrescoApi.getInstance()).getTicketAuth());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ describe('UserPreferencesService', () => {
|
|||||||
appConfig.config = {
|
appConfig.config = {
|
||||||
pagination: {
|
pagination: {
|
||||||
'size': 10,
|
'size': 10,
|
||||||
'supportedPageSizes': [ 5, 10, 15, 20 ]
|
'supportedPageSizes': [5, 10, 15, 20]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
preferences = TestBed.get(UserPreferencesService);
|
preferences = TestBed.get(UserPreferencesService);
|
||||||
@ -99,6 +99,12 @@ describe('UserPreferencesService', () => {
|
|||||||
expect(storage.getItem(propertyKey)).toBe('valueA');
|
expect(storage.getItem(propertyKey)).toBe('valueA');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should null value return default prefix', () => {
|
||||||
|
storage.setItem('paginationSize', null);
|
||||||
|
const paginationSize = preferences.getPropertyKey('paginationSize');
|
||||||
|
expect(preferences.get(paginationSize, 'default')).toBe('default');
|
||||||
|
});
|
||||||
|
|
||||||
it('should save value with custom prefix', () => {
|
it('should save value with custom prefix', () => {
|
||||||
preferences.setStoragePrefix('USER_A');
|
preferences.setStoragePrefix('USER_A');
|
||||||
preferences.set('propertyA', 'valueA');
|
preferences.set('propertyA', 'valueA');
|
||||||
|
@ -51,7 +51,7 @@ export class UserPreferencesService {
|
|||||||
get(property: string, defaultValue?: string): string {
|
get(property: string, defaultValue?: string): string {
|
||||||
const key = this.getPropertyKey(property);
|
const key = this.getPropertyKey(property);
|
||||||
const value = this.storage.getItem(key);
|
const value = this.storage.getItem(key);
|
||||||
if (value === undefined) {
|
if (value === undefined || value === null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -87,7 +87,7 @@ export class TaskFilterService {
|
|||||||
/**
|
/**
|
||||||
* Retrieve all the Tasks filters
|
* Retrieve all the Tasks filters
|
||||||
*/
|
*/
|
||||||
getTaskListFilters(appId?: number): Observable<any> {
|
getTaskListFilters(appId?: number): Observable<FilterRepresentationModel[]> {
|
||||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||||
.map((response: any) => {
|
.map((response: any) => {
|
||||||
let filters: FilterRepresentationModel[] = [];
|
let filters: FilterRepresentationModel[] = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user