@@ -44,7 +44,11 @@ function mountWorkbench() {
4444 NcChip : { template : '<button class="nc-chip-stub">{{ text }}</button>' , props : [ 'text' ] } ,
4545 NcCheckboxRadioSwitch : { template : '<input type="checkbox" @change="$emit(\'update:modelValue\', $event.target.checked)" />' } ,
4646 NcSelectUsers : { template : '<div class="nc-select-users-stub" />' } ,
47- NcActions : { template : '<div class="nc-actions-stub"><button class="nc-actions-stub__trigger" aria-label="Filter rules by scope"><slot name="icon" /></button><slot /></div>' } ,
47+ NcActions : {
48+ props : [ 'open' , 'ariaLabel' ] ,
49+ emits : [ 'update:open' ] ,
50+ template : '<div class="nc-actions-stub"><button class="nc-actions-stub__trigger" :aria-label="ariaLabel" @click="$emit(\'update:open\', !open)"><slot name="icon" /></button><div v-if="open" class="nc-actions-stub__menu"><slot /></div></div>' ,
51+ } ,
4852 NcActionButton : { template : '<button @click="$emit(\'click\')"><slot /></button>' } ,
4953 } ,
5054 } ,
@@ -89,10 +93,10 @@ describe('RealPolicyWorkbench.vue', () => {
8993 expect ( userIndex ) . toBeLessThan ( groupIndex )
9094 } )
9195
92- it ( 'shows callout when there is no persisted global default rule ' , async ( ) => {
96+ it ( 'shows unified default summary in system default mode ' , async ( ) => {
9397 getPolicy . mockImplementation ( ( key : string ) => {
9498 if ( key === 'signature_flow' ) {
95- return { effectiveValue : 'none' }
99+ return { effectiveValue : 'none' , sourceScope : 'system' }
96100 }
97101
98102 return null
@@ -103,9 +107,14 @@ describe('RealPolicyWorkbench.vue', () => {
103107 expect ( openPolicyButton ) . toBeTruthy ( )
104108 await openPolicyButton ?. trigger ( 'click' )
105109
106- expect ( wrapper . text ( ) ) . toContain ( 'No instance default is configured. This setting currently uses the system default.' )
107- expect ( wrapper . text ( ) ) . toContain ( 'Set instance default' )
108- expect ( wrapper . text ( ) ) . not . toContain ( 'Instance default' )
110+ const text = wrapper . text ( )
111+ expect ( text ) . toContain ( 'Control how signers complete documents.' )
112+ expect ( text ) . toContain ( 'Default:' )
113+ expect ( text ) . toContain ( 'Let users choose' )
114+ expect ( text ) . toContain ( '(system)' )
115+ expect ( text ) . toContain ( 'Change' )
116+ expect ( text ) . not . toContain ( 'Effective result:' )
117+ expect ( text ) . not . toContain ( 'No instance default is configured. This setting currently uses the system default.' )
109118 } )
110119
111120 it ( 'shows signing order with sophisticated visual interface: filter, toggle, counts, and scopes' , async ( ) => {
@@ -131,11 +140,21 @@ describe('RealPolicyWorkbench.vue', () => {
131140
132141 // Validate signing order is displayed with compact header copy
133142 expect ( text ) . toContain ( 'Signing order' )
134- expect ( text ) . toContain ( 'Define whether signers work in parallel or in a sequential order ' )
143+ expect ( text ) . toContain ( 'Control how signers complete documents. ' )
135144
136- // Validate default value is shown in concise baseline summary
137- expect ( text ) . toContain ( 'Sequential' )
145+ // Validate default summary block content for custom default mode
138146 expect ( text ) . toContain ( 'Default:' )
147+ expect ( text ) . toContain ( 'Sequential' )
148+ expect ( text ) . toContain ( '(custom)' )
149+ expect ( text ) . toContain ( 'Change' )
150+ expect ( text ) . not . toContain ( 'Effective result:' )
151+
152+ const tableHeaders = wrapper . findAll ( 'th' ) . map ( ( header ) => header . text ( ) )
153+ expect ( tableHeaders ) . toContain ( 'Type' )
154+ expect ( tableHeaders ) . toContain ( 'Target' )
155+ expect ( tableHeaders ) . toContain ( 'Value' )
156+ expect ( tableHeaders ) . toContain ( 'Actions' )
157+ expect ( tableHeaders ) . not . toContain ( 'Behavior' )
139158
140159 // Validate noisy inheritance warning is not shown by default
141160 expect ( text ) . not . toContain ( 'Some users may not allow user overrides because their group rule requires inheritance.' )
@@ -149,5 +168,26 @@ describe('RealPolicyWorkbench.vue', () => {
149168 expect ( text ) . not . toContain ( 'Identification factors' )
150169 } )
151170
171+ it ( 'closes the rule actions menu after clicking edit' , async ( ) => {
172+ const wrapper = mountWorkbench ( )
173+
174+ const openPolicyButton = wrapper . findAll ( 'button' ) . find ( ( button ) => button . text ( ) . includes ( 'Open policy' ) )
175+ expect ( openPolicyButton ) . toBeTruthy ( )
176+ await openPolicyButton ?. trigger ( 'click' )
177+
178+ const actionsTrigger = wrapper . find ( 'button[aria-label="Rule actions"]' )
179+ expect ( actionsTrigger . exists ( ) ) . toBe ( true )
180+ await actionsTrigger . trigger ( 'click' )
181+
182+ expect ( wrapper . find ( '.nc-actions-stub__menu' ) . exists ( ) ) . toBe ( true )
183+
184+ const editButton = wrapper . findAll ( '.nc-actions-stub__menu button' ) . find ( ( button ) => button . text ( ) === 'Edit' )
185+ expect ( editButton ) . toBeTruthy ( )
186+ await editButton ?. trigger ( 'click' )
187+
188+ expect ( wrapper . find ( '.nc-actions-stub__menu' ) . exists ( ) ) . toBe ( false )
189+ expect ( wrapper . text ( ) ) . toContain ( 'Global default rule' )
190+ } )
191+
152192} )
153193
0 commit comments