@@ -30,6 +30,14 @@ describe('SigningRequirementValidator', () => {
3030 identificationDocumentStore ?: IdentificationDocumentStoreOverrides
3131 }
3232
33+ const visibleSignatureElement = {
34+ elementId : 101 ,
35+ fileId : 1 ,
36+ signRequestId : 10 ,
37+ type : 'signature' ,
38+ coordinates : { page : 1 , left : 10 , top : 20 } ,
39+ }
40+
3341 const createStores = ( overrides : StoresOverrides = { } ) => {
3442 const signStore = {
3543 errors : [ ] ,
@@ -44,7 +52,7 @@ describe('SigningRequirementValidator', () => {
4452 identifyMethod : 'email' ,
4553 identifyValue : 'signer@example.com' ,
4654 } ] ,
47- visibleElements : [ { signRequestId : 10 } ] ,
55+ visibleElements : [ visibleSignatureElement ] ,
4856 } ,
4957 ...overrides . signStore ,
5058 }
@@ -185,6 +193,39 @@ describe('SigningRequirementValidator', () => {
185193 expect ( result ) . toBe ( false )
186194 } )
187195
196+ it ( 'requires createSignature when current signer visible elements are only on envelope child files' , ( ) => {
197+ const stores = createStores ( {
198+ signStore : {
199+ document : {
200+ signers : [ { me : true , signRequestId : 700 } ] ,
201+ visibleElements : [ ] ,
202+ files : [
203+ {
204+ id : 10 ,
205+ signers : [ { me : true , signRequestId : 501 } ] ,
206+ visibleElements : [ {
207+ elementId : 201 ,
208+ fileId : 10 ,
209+ signRequestId : 501 ,
210+ type : 'signature' ,
211+ coordinates : { page : 1 , left : 15 , top : 25 } ,
212+ } ] ,
213+ } ,
214+ ] ,
215+ } ,
216+ } ,
217+ } )
218+ const validator = new SigningRequirementValidator (
219+ stores . signStore ,
220+ stores . signMethodsStore ,
221+ stores . identificationDocumentStore ,
222+ )
223+
224+ const result = validator . needsCreateSignature ( { hasSignatures : false , canCreateSignature : true } )
225+
226+ expect ( result ) . toBe ( true )
227+ } )
228+
188229 it ( 'returns createSignature before clickToSign when no signature exists' , ( ) => {
189230 const stores = createStores ( {
190231 signMethodsStore : {
0 commit comments