@@ -308,6 +308,116 @@ describe('SignatureFooterRuleEditor.vue', () => {
308308 expect ( wrapper . find ( '.button-stub' ) . exists ( ) ) . toBe ( true )
309309 } )
310310
311+ it ( 'shows reset button when customized template has no inherited baseline in system scope' , ( ) => {
312+ const wrapper = createWrapper ( asModelValue ( {
313+ enabled : true ,
314+ writeQrcodeOnFooter : true ,
315+ validationSite : '' ,
316+ customizeFooterTemplate : true ,
317+ footerTemplate : 'System custom footer' ,
318+ } ) )
319+
320+ expect ( wrapper . find ( '.button-stub' ) . exists ( ) ) . toBe ( true )
321+ } )
322+
323+ it ( 'shows reset button when customized template has no inherited baseline in group scope' , ( ) => {
324+ const wrapper = mount ( SignatureFooterRuleEditor , {
325+ props : {
326+ modelValue : asModelValue ( {
327+ enabled : true ,
328+ writeQrcodeOnFooter : true ,
329+ validationSite : '' ,
330+ customizeFooterTemplate : true ,
331+ footerTemplate : 'Group custom footer' ,
332+ } ) ,
333+ editorScope : 'group' ,
334+ showPreview : false ,
335+ } ,
336+ global : {
337+ stubs : {
338+ NcCheckboxRadioSwitch : {
339+ name : 'NcCheckboxRadioSwitch' ,
340+ props : [ 'modelValue' ] ,
341+ emits : [ 'update:modelValue' ] ,
342+ template : '<div class="switch-stub" @click="$emit(\'update:modelValue\', !modelValue)"><slot /></div>' ,
343+ } ,
344+ NcTextField : {
345+ name : 'NcTextField' ,
346+ props : [ 'modelValue' ] ,
347+ emits : [ 'update:modelValue' ] ,
348+ template : '<input class="text-field-stub" :value="modelValue" @input="$emit(\'update:modelValue\', $event.target.value)" />' ,
349+ } ,
350+ NcButton : {
351+ name : 'NcButton' ,
352+ emits : [ 'click' ] ,
353+ template : '<button class="button-stub" @click="$emit(\'click\')"><slot /></button>' ,
354+ } ,
355+ NcIconSvgWrapper : {
356+ name : 'NcIconSvgWrapper' ,
357+ template : '<span class="icon-stub" />' ,
358+ } ,
359+ CodeEditor : {
360+ name : 'CodeEditor' ,
361+ props : [ 'modelValue' ] ,
362+ emits : [ 'update:modelValue' ] ,
363+ template : '<div class="code-editor-wrapper-stub"><div class="code-editor-header-stub"><slot name="label-actions" /></div><textarea class="code-editor-stub" :value="modelValue" @input="$emit(\'update:modelValue\', $event.target.value)" /></div>' ,
364+ } ,
365+ } ,
366+ } ,
367+ } )
368+
369+ expect ( wrapper . find ( '.button-stub' ) . exists ( ) ) . toBe ( true )
370+ } )
371+
372+ it ( 'shows reset button when customized template has no inherited baseline in user scope' , ( ) => {
373+ const wrapper = mount ( SignatureFooterRuleEditor , {
374+ props : {
375+ modelValue : asModelValue ( {
376+ enabled : true ,
377+ writeQrcodeOnFooter : true ,
378+ validationSite : '' ,
379+ customizeFooterTemplate : true ,
380+ footerTemplate : 'User custom footer' ,
381+ } ) ,
382+ editorScope : 'user' ,
383+ showPreview : false ,
384+ } ,
385+ global : {
386+ stubs : {
387+ NcCheckboxRadioSwitch : {
388+ name : 'NcCheckboxRadioSwitch' ,
389+ props : [ 'modelValue' ] ,
390+ emits : [ 'update:modelValue' ] ,
391+ template : '<div class="switch-stub" @click="$emit(\'update:modelValue\', !modelValue)"><slot /></div>' ,
392+ } ,
393+ NcTextField : {
394+ name : 'NcTextField' ,
395+ props : [ 'modelValue' ] ,
396+ emits : [ 'update:modelValue' ] ,
397+ template : '<input class="text-field-stub" :value="modelValue" @input="$emit(\'update:modelValue\', $event.target.value)" />' ,
398+ } ,
399+ NcButton : {
400+ name : 'NcButton' ,
401+ emits : [ 'click' ] ,
402+ template : '<button class="button-stub" @click="$emit(\'click\')"><slot /></button>' ,
403+ } ,
404+ NcIconSvgWrapper : {
405+ name : 'NcIconSvgWrapper' ,
406+ template : '<span class="icon-stub" />' ,
407+ } ,
408+ CodeEditor : {
409+ name : 'CodeEditor' ,
410+ props : [ 'modelValue' ] ,
411+ emits : [ 'update:modelValue' ] ,
412+ template : '<div class="code-editor-wrapper-stub"><div class="code-editor-header-stub"><slot name="label-actions" /></div><textarea class="code-editor-stub" :value="modelValue" @input="$emit(\'update:modelValue\', $event.target.value)" /></div>' ,
413+ } ,
414+ } ,
415+ } ,
416+ } )
417+
418+ expect ( wrapper . find ( '.button-stub' ) . exists ( ) ) . toBe ( true )
419+ } )
420+
311421 it ( 'hides reset button when current template equals inherited template' , ( ) => {
312422 const wrapper = createWrapper ( asModelValue ( {
313423 enabled : true ,
@@ -428,7 +538,7 @@ describe('SignatureFooterRuleEditor.vue', () => {
428538 const model = parseEmittedValue ( ( wrapper . vm as { value : EffectivePolicyValue } ) . value )
429539 expect ( model ) . toMatchObject ( {
430540 customizeFooterTemplate : true ,
431- footerTemplate : '' ,
541+ footerTemplate : 'Inherited footer template ' ,
432542 } )
433543 } )
434544
0 commit comments