[ADF-2265] fix user preference null value (#2948)

* fix user preference null value

* fix method call test public
This commit is contained in:
Eugenio Romano
2018-02-15 09:30:35 +00:00
committed by Denys Vuika
parent 63a146616b
commit 6e57cd3e17
4 changed files with 11 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ describe('UserPreferencesService', () => {
appConfig.config = {
pagination: {
'size': 10,
'supportedPageSizes': [ 5, 10, 15, 20 ]
'supportedPageSizes': [5, 10, 15, 20]
}
};
preferences = TestBed.get(UserPreferencesService);
@@ -99,6 +99,12 @@ describe('UserPreferencesService', () => {
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', () => {
preferences.setStoragePrefix('USER_A');
preferences.set('propertyA', 'valueA');