@@ -94,6 +94,40 @@ describe('ActionBar (action:bar)', () => {
9494 expect ( container . textContent ) . toContain ( 'Action 1' ) ;
9595 expect ( container . textContent ) . toContain ( 'Action 2' ) ;
9696 } ) ;
97+
98+ it ( 'deduplicates actions by name' , ( ) => {
99+ const { container } = renderComponent ( {
100+ type : 'action:bar' ,
101+ actions : [
102+ { name : 'change_status' , label : 'Change Status' , type : 'script' , component : 'action:button' } ,
103+ { name : 'assign_user' , label : 'Assign User' , type : 'script' , component : 'action:button' } ,
104+ { name : 'change_status' , label : 'Change Status' , type : 'script' , component : 'action:button' } ,
105+ ] ,
106+ } ) ;
107+ const toolbar = container . querySelector ( '[role="toolbar"]' ) ;
108+ expect ( toolbar ) . toBeTruthy ( ) ;
109+ // Should only render 2 actions (duplicates removed)
110+ expect ( toolbar ! . children . length ) . toBe ( 2 ) ;
111+ expect ( container . textContent ) . toContain ( 'Change Status' ) ;
112+ expect ( container . textContent ) . toContain ( 'Assign User' ) ;
113+ } ) ;
114+
115+ it ( 'deduplicates actions after location filtering' , ( ) => {
116+ const { container } = renderComponent ( {
117+ type : 'action:bar' ,
118+ location : 'record_header' ,
119+ actions : [
120+ { name : 'change_status' , label : 'Change Status' , type : 'script' , locations : [ 'record_header' ] } ,
121+ { name : 'assign_user' , label : 'Assign User' , type : 'script' , locations : [ 'record_header' ] } ,
122+ { name : 'change_status' , label : 'Change Status' , type : 'script' , locations : [ 'record_header' , 'record_more' ] } ,
123+ { name : 'assign_user' , label : 'Assign User' , type : 'script' , locations : [ 'record_header' ] } ,
124+ ] ,
125+ } ) ;
126+ const toolbar = container . querySelector ( '[role="toolbar"]' ) ;
127+ expect ( toolbar ) . toBeTruthy ( ) ;
128+ // Should only render 2 unique actions
129+ expect ( toolbar ! . children . length ) . toBe ( 2 ) ;
130+ } ) ;
97131 } ) ;
98132
99133 describe ( 'overflow' , ( ) => {
0 commit comments