@@ -65,7 +65,7 @@ describe('UserState Utils', () => {
6565 const result = getIconStyle ( item ) ;
6666 expect ( result ) . toEqual ( {
6767 class : 'available' ,
68- iconName : 'recents -presence-filled' ,
68+ iconName : 'active -presence-small -filled' ,
6969 } ) ;
7070 } ) ;
7171
@@ -74,7 +74,7 @@ describe('UserState Utils', () => {
7474 const result = getIconStyle ( item ) ;
7575 expect ( result ) . toEqual ( {
7676 class : 'rona' ,
77- iconName : 'warning -filled' ,
77+ iconName : 'dnd-presence -filled' ,
7878 } ) ;
7979 } ) ;
8080
@@ -86,6 +86,15 @@ describe('UserState Utils', () => {
8686 iconName : 'recents-presence-filled' ,
8787 } ) ;
8888 } ) ;
89+
90+ it ( 'should return custom style for items with developerName' , ( ) => {
91+ const item = { id : '1' , name : 'Custom State' , developerName : 'CUSTOM' } ;
92+ const result = getIconStyle ( item ) ;
93+ expect ( result ) . toEqual ( {
94+ class : 'custom' ,
95+ iconName : 'busy-presence-light' ,
96+ } ) ;
97+ } ) ;
8998 } ) ;
9099
91100 describe ( 'getTooltipText' , ( ) => {
@@ -224,22 +233,22 @@ describe('UserState Utils', () => {
224233 it ( 'should return custom key when customState is present' , ( ) => {
225234 const customState = { name : 'Custom State' , developerName : 'CUSTOM' } ;
226235 const result = getSelectedKey ( customState , '1' , mockIdleCodes ) ;
227- expect ( result ) . toBe ( 'custom -CUSTOM' ) ;
236+ expect ( result ) . toBe ( 'hide -CUSTOM' ) ;
228237 } ) ;
229238
230239 it ( 'should return currentState for normal states' , ( ) => {
231240 const result = getSelectedKey ( null , '1' , mockIdleCodes ) ;
232241 expect ( result ) . toBe ( '1' ) ;
233242 } ) ;
234243
235- it ( 'should return previous selectable state for RONA' , ( ) => {
244+ it ( 'should return hide-prefixed key for RONA when it is current state ' , ( ) => {
236245 const result = getSelectedKey ( null , '3' , mockIdleCodes ) ;
237- expect ( result ) . toBe ( '0 ' ) ; // Available is the first selectable state
246+ expect ( result ) . toBe ( 'hide-3 ' ) ;
238247 } ) ;
239248
240249 it ( 'should return previous selectable state for ENGAGED' , ( ) => {
241250 const result = getSelectedKey ( null , '4' , mockIdleCodes ) ;
242- expect ( result ) . toBe ( '0' ) ; // Available is the first selectable state
251+ expect ( result ) . toBe ( '0' ) ;
243252 } ) ;
244253
245254 it ( 'should handle missing currentState in idleCodes' , ( ) => {
@@ -250,7 +259,7 @@ describe('UserState Utils', () => {
250259
251260 describe ( 'buildDropdownItems' , ( ) => {
252261 it ( 'should filter out RONA and ENGAGED states' , ( ) => {
253- const result = buildDropdownItems ( null , mockIdleCodes ) ;
262+ const result = buildDropdownItems ( null , mockIdleCodes , '1' ) ;
254263
255264 expect ( result ) . toEqual ( [
256265 { id : '0' , name : 'Available' } ,
@@ -261,26 +270,26 @@ describe('UserState Utils', () => {
261270
262271 it ( 'should include custom state when present' , ( ) => {
263272 const customState = { name : 'Custom State' , developerName : 'CUSTOM' } ;
264- const result = buildDropdownItems ( customState , mockIdleCodes ) ;
273+ const result = buildDropdownItems ( customState , mockIdleCodes , '1' ) ;
265274
266275 expect ( result ) . toEqual ( [
276+ { id : 'hide-CUSTOM' , name : 'Custom State' , developerName : 'CUSTOM' } ,
267277 { id : '0' , name : 'Available' } ,
268278 { id : '1' , name : 'Break' } ,
269279 { id : '2' , name : 'Training' } ,
270- { id : 'custom-CUSTOM' , name : 'Custom State' } ,
271280 ] ) ;
272281 } ) ;
273282
274283 it ( 'should handle empty idleCodes array' , ( ) => {
275- const result = buildDropdownItems ( null , [ ] ) ;
284+ const result = buildDropdownItems ( null , [ ] , '1' ) ;
276285 expect ( result ) . toEqual ( [ ] ) ;
277286 } ) ;
278287
279288 it ( 'should handle empty idleCodes array with custom state' , ( ) => {
280289 const customState = { name : 'Custom State' , developerName : 'CUSTOM' } ;
281- const result = buildDropdownItems ( customState , [ ] ) ;
290+ const result = buildDropdownItems ( customState , [ ] , '1' ) ;
282291
283- expect ( result ) . toEqual ( [ { id : 'custom -CUSTOM' , name : 'Custom State' } ] ) ;
292+ expect ( result ) . toEqual ( [ { id : 'hide -CUSTOM' , name : 'Custom State' , developerName : 'CUSTOM '} ] ) ;
284293 } ) ;
285294
286295 it ( 'should handle idleCodes with only RONA and ENGAGED' , ( ) => {
@@ -289,8 +298,30 @@ describe('UserState Utils', () => {
289298 { id : '4' , name : 'ENGAGED' , isSystem : true , isDefault : false } ,
290299 ] ;
291300
292- const result = buildDropdownItems ( null , ronaEngagedOnly ) ;
301+ const result = buildDropdownItems ( null , ronaEngagedOnly , '1' ) ;
293302 expect ( result ) . toEqual ( [ ] ) ;
294303 } ) ;
304+
305+ it ( 'should include RONA when it is the current state' , ( ) => {
306+ const result = buildDropdownItems ( null , mockIdleCodes , '3' ) ;
307+
308+ expect ( result ) . toEqual ( [
309+ { id : '0' , name : 'Available' } ,
310+ { id : '1' , name : 'Break' } ,
311+ { id : '2' , name : 'Training' } ,
312+ { id : 'hide-3' , name : 'RONA' , isSystem : true , isDefault : false } ,
313+ ] ) ;
314+ } ) ;
315+
316+ it ( 'should use correct prefix for custom state' , ( ) => {
317+ const customState = { name : 'Custom State' , developerName : 'CUSTOM' } ;
318+ const result = buildDropdownItems ( customState , mockIdleCodes , '1' ) ;
319+
320+ expect ( result [ 0 ] ) . toEqual ( {
321+ id : 'hide-CUSTOM' ,
322+ name : 'Custom State' ,
323+ developerName : 'CUSTOM' ,
324+ } ) ;
325+ } ) ;
295326 } ) ;
296327} ) ;
0 commit comments