11import {
22 AccessibilitySettingsService ,
3- AccessibilitySetting ,
43 AccessibilitySettings ,
54 ACCESSIBILITY_SETTINGS_METADATA_KEY ,
65 ACCESSIBILITY_COOKIE
@@ -41,17 +40,6 @@ describe('accessibilitySettingsService', () => {
4140 ) ;
4241 } ) ;
4342
44- describe ( 'getALlAccessibilitySettingsKeys' , ( ) => {
45- it ( 'should return an array containing all accessibility setting names' , ( ) => {
46- const settingNames : AccessibilitySetting [ ] = [
47- AccessibilitySetting . NotificationTimeOut ,
48- AccessibilitySetting . LiveRegionTimeOut ,
49- ] ;
50-
51- expect ( service . getAllAccessibilitySettingKeys ( ) ) . toEqual ( settingNames ) ;
52- } ) ;
53- } ) ;
54-
5543 describe ( 'get' , ( ) => {
5644 it ( 'should return the setting if it is set' , ( ) => {
5745 const settings : AccessibilitySettings = {
@@ -60,7 +48,7 @@ describe('accessibilitySettingsService', () => {
6048
6149 service . getAll = jasmine . createSpy ( 'getAll' ) . and . returnValue ( of ( settings ) ) ;
6250
63- service . get ( AccessibilitySetting . NotificationTimeOut , 'default' ) . subscribe ( value =>
51+ service . get ( 'notificationTimeOut' , 'default' ) . subscribe ( value =>
6452 expect ( value ) . toEqual ( '1000' )
6553 ) ;
6654 } ) ;
@@ -72,7 +60,7 @@ describe('accessibilitySettingsService', () => {
7260
7361 service . getAll = jasmine . createSpy ( 'getAll' ) . and . returnValue ( of ( settings ) ) ;
7462
75- service . get ( AccessibilitySetting . LiveRegionTimeOut , 'default' ) . subscribe ( value =>
63+ service . get ( 'liveRegionTimeOut' , 'default' ) . subscribe ( value =>
7664 expect ( value ) . toEqual ( 'default' )
7765 ) ;
7866 } ) ;
@@ -82,23 +70,23 @@ describe('accessibilitySettingsService', () => {
8270 it ( 'should return the setting as number if the value for the setting can be parsed to a number' , ( ) => {
8371 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( '1000' ) ) ;
8472
85- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut ) . subscribe ( value =>
73+ service . getAsNumber ( 'notificationTimeOut' ) . subscribe ( value =>
8674 expect ( value ) . toEqual ( 1000 )
8775 ) ;
8876 } ) ;
8977
9078 it ( 'should return the default value if no value is set for the setting' , ( ) => {
9179 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( null ) ) ;
9280
93- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut , 123 ) . subscribe ( value =>
81+ service . getAsNumber ( 'notificationTimeOut' , 123 ) . subscribe ( value =>
9482 expect ( value ) . toEqual ( 123 )
9583 ) ;
9684 } ) ;
9785
9886 it ( 'should return the default value if the value for the setting can not be parsed to a number' , ( ) => {
9987 service . get = jasmine . createSpy ( 'get' ) . and . returnValue ( of ( 'text' ) ) ;
10088
101- service . getAsNumber ( AccessibilitySetting . NotificationTimeOut , 123 ) . subscribe ( value =>
89+ service . getAsNumber ( 'notificationTimeOut' , 123 ) . subscribe ( value =>
10290 expect ( value ) . toEqual ( 123 )
10391 ) ;
10492 } ) ;
@@ -176,7 +164,7 @@ describe('accessibilitySettingsService', () => {
176164 it ( 'should correctly update the chosen setting' , ( ) => {
177165 service . updateSettings = jasmine . createSpy ( 'updateSettings' ) ;
178166
179- service . set ( AccessibilitySetting . LiveRegionTimeOut , '500' ) ;
167+ service . set ( 'liveRegionTimeOut' , '500' ) ;
180168 expect ( service . updateSettings ) . toHaveBeenCalledWith ( { liveRegionTimeOut : '500' } ) ;
181169 } ) ;
182170 } ) ;
@@ -307,7 +295,7 @@ describe('accessibilitySettingsService', () => {
307295 } ) ;
308296
309297 it ( 'should set the settings in metadata' , ( ) => {
310- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
298+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
311299 expect ( ePerson . setMetadata ) . toHaveBeenCalled ( ) ;
312300 } ) ;
313301
@@ -318,19 +306,19 @@ describe('accessibilitySettingsService', () => {
318306 } ) ;
319307
320308 it ( 'should create a patch with the metadata changes' , ( ) => {
321- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
309+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
322310 expect ( ePersonService . createPatchFromCache ) . toHaveBeenCalled ( ) ;
323311 } ) ;
324312
325313 it ( 'should send the patch request' , ( ) => {
326- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) . subscribe ( ) ;
314+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } ) . subscribe ( ) ;
327315 expect ( ePersonService . patch ) . toHaveBeenCalled ( ) ;
328316 } ) ;
329317
330318 it ( 'should emit true when the update succeeded' , fakeAsync ( ( ) => {
331319 ePersonService . patch = jasmine . createSpy ( ) . and . returnValue ( createSuccessfulRemoteDataObject$ ( { } ) ) ;
332320
333- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } )
321+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } )
334322 . subscribe ( value => {
335323 expect ( value ) . toBeTrue ( ) ;
336324 } ) ;
@@ -341,7 +329,7 @@ describe('accessibilitySettingsService', () => {
341329 it ( 'should emit false when the update failed' , fakeAsync ( ( ) => {
342330 ePersonService . patch = jasmine . createSpy ( ) . and . returnValue ( createFailedRemoteDataObject$ ( ) ) ;
343331
344- service . setSettingsInMetadata ( ePerson , { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } )
332+ service . setSettingsInMetadata ( ePerson , { [ 'liveRegionTimeOut' ] : '500' } )
345333 . subscribe ( value => {
346334 expect ( value ) . toBeFalse ( ) ;
347335 } ) ;
@@ -357,7 +345,7 @@ describe('accessibilitySettingsService', () => {
357345 } ) ;
358346
359347 it ( 'should store the settings in a cookie' , ( ) => {
360- service . setSettingsInCookie ( { [ AccessibilitySetting . LiveRegionTimeOut ] : '500' } ) ;
348+ service . setSettingsInCookie ( { [ 'liveRegionTimeOut' ] : '500' } ) ;
361349 expect ( cookieService . set ) . toHaveBeenCalled ( ) ;
362350 } ) ;
363351
0 commit comments