@@ -17,7 +17,6 @@ import { AuthServiceStub } from '../shared/testing/auth-service.stub';
1717import {
1818 ACCESSIBILITY_COOKIE ,
1919 ACCESSIBILITY_SETTINGS_METADATA_KEY ,
20- AccessibilitySetting ,
2120 AccessibilitySettings ,
2221 AccessibilitySettingsService ,
2322} from './accessibility-settings.service' ;
@@ -48,17 +47,6 @@ describe('accessibilitySettingsService', () => {
4847 ) ;
4948 } ) ;
5049
51- describe ( 'getALlAccessibilitySettingsKeys' , ( ) => {
52- it ( 'should return an array containing all accessibility setting names' , ( ) => {
53- const settingNames : AccessibilitySetting [ ] = [
54- AccessibilitySetting . NotificationTimeOut ,
55- AccessibilitySetting . LiveRegionTimeOut ,
56- ] ;
57-
58- expect ( service . getAllAccessibilitySettingKeys ( ) ) . toEqual ( settingNames ) ;
59- } ) ;
60- } ) ;
61-
6250 describe ( 'get' , ( ) => {
6351 it ( 'should return the setting if it is set' , ( ) => {
6452 const settings : AccessibilitySettings = {
@@ -67,7 +55,7 @@ describe('accessibilitySettingsService', () => {
6755
6856 service . getAll = jasmine . createSpy ( 'getAll' ) . and . returnValue ( of ( settings ) ) ;
6957
70- service . get ( AccessibilitySetting . NotificationTimeOut , 'default' ) . subscribe ( value =>
58+ service . get ( 'notificationTimeOut' , 'default' ) . subscribe ( value =>
7159 expect ( value ) . toEqual ( '1000' ) ,
7260 ) ;
7361 } ) ;
@@ -79,7 +67,7 @@ describe('accessibilitySettingsService', () => {
7967
8068 service . getAll = jasmine . createSpy ( 'getAll' ) . and . returnValue ( of ( settings ) ) ;
8169
82- service . get ( AccessibilitySetting . LiveRegionTimeOut , 'default' ) . subscribe ( value =>
70+ service . get ( 'liveRegionTimeOut' , 'default' ) . subscribe ( value =>
8371 expect ( value ) . toEqual ( 'default' ) ,
8472 ) ;
8573 } ) ;
@@ -89,23 +77,23 @@ describe('accessibilitySettingsService', () => {
8977 it ( 'should return the setting as number if the value for the setting can be parsed to a number' , ( ) => {
9078 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( '1000' ) ) ;
9179
92- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut ) . subscribe ( value =>
80+ service . getAsNumber ( 'notificationTimeOut' ) . subscribe ( value =>
9381 expect ( value ) . toEqual ( 1000 ) ,
9482 ) ;
9583 } ) ;
9684
9785 it ( 'should return the default value if no value is set for the setting' , ( ) => {
9886 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( null ) ) ;
9987
100- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut , 123 ) . subscribe ( value =>
88+ service . getAsNumber ( 'notificationTimeOut' , 123 ) . subscribe ( value =>
10189 expect ( value ) . toEqual ( 123 ) ,
10290 ) ;
10391 } ) ;
10492
10593 it ( 'should return the default value if the value for the setting can not be parsed to a number' , ( ) => {
10694 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( 'text' ) ) ;
10795
108- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut , 123 ) . subscribe ( value =>
96+ service . getAsNumber ( 'notificationTimeOut' , 123 ) . subscribe ( value =>
10997 expect ( value ) . toEqual ( 123 ) ,
11098 ) ;
11199 } ) ;
@@ -183,7 +171,7 @@ describe('accessibilitySettingsService', () => {
183171 it ( 'should correctly update the chosen setting' , ( ) => {
184172 service . updateSettings = jasmine . createSpy ( 'updateSettings' ) ;
185173
186- service . set ( AccessibilitySetting . LiveRegionTimeOut , '500' ) ;
174+ service . set ( 'liveRegionTimeOut' , '500' ) ;
187175 expect ( service . updateSettings ) . toHaveBeenCalledWith ( { liveRegionTimeOut : '500' } ) ;
188176 } ) ;
189177 } ) ;
@@ -314,7 +302,7 @@ describe('accessibilitySettingsService', () => {
314302 } ) ;
315303
316304 it ( 'should set the settings in metadata' , ( ) => {
317- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
305+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
318306 expect ( ePerson . setMetadata ) . toHaveBeenCalled ( ) ;
319307 } ) ;
320308
@@ -325,19 +313,19 @@ describe('accessibilitySettingsService', () => {
325313 } ) ;
326314
327315 it ( 'should create a patch with the metadata changes' , ( ) => {
328- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
316+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
329317 expect ( ePersonService . createPatchFromCache ) . toHaveBeenCalled ( ) ;
330318 } ) ;
331319
332320 it ( 'should send the patch request' , ( ) => {
333- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
321+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
334322 expect ( ePersonService . patch ) . toHaveBeenCalled ( ) ;
335323 } ) ;
336324
337325 it ( 'should emit true when the update succeeded' , fakeAsync ( ( ) => {
338326 ePersonService . patch = jasmine . createSpy ( ) . and . returnValue ( createSuccessfulRemoteDataObject$ ( { } ) ) ;
339327
340- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } )
328+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } )
341329 . subscribe ( value => {
342330 expect ( value ) . toBeTrue ( ) ;
343331 } ) ;
@@ -348,7 +336,7 @@ describe('accessibilitySettingsService', () => {
348336 it ( 'should emit false when the update failed' , fakeAsync ( ( ) => {
349337 ePersonService . patch = jasmine . createSpy ( ) . and . returnValue ( createFailedRemoteDataObject$ ( ) ) ;
350338
351- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } )
339+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } )
352340 . subscribe ( value => {
353341 expect ( value ) . toBeFalse ( ) ;
354342 } ) ;
@@ -364,7 +352,7 @@ describe('accessibilitySettingsService', () => {
364352 } ) ;
365353
366354 it ( 'should store the settings in a cookie' , ( ) => {
367- service . setSettingsInCookie ( { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) ;
355+ service . setSettingsInCookie ( { [ 'liveRegionTimeOut' ] : '500' } ) ;
368356 expect ( cookieService . set ) . toHaveBeenCalled ( ) ;
369357 } ) ;
370358
@@ -375,12 +363,4 @@ describe('accessibilitySettingsService', () => {
375363 } ) ;
376364 } ) ;
377365
378- describe ( 'getInputType' , ( ) => {
379- it ( 'should correctly return the input type' , ( ) => {
380- expect ( service . getInputType ( AccessibilitySetting . NotificationTimeOut ) ) . toEqual ( 'number' ) ;
381- expect ( service . getInputType ( AccessibilitySetting . LiveRegionTimeOut ) ) . toEqual ( 'number' ) ;
382- expect ( service . getInputType ( 'unknownValue' as AccessibilitySetting ) ) . toEqual ( 'text' ) ;
383- } ) ;
384- } ) ;
385-
386366} ) ;
0 commit comments