Skip to content

Commit 841e8e6

Browse files
test: cover envelope child visible signature in sign view
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent ddb9bd8 commit 841e8e6

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

src/tests/views/SignPDF/Sign.spec.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,69 @@ describe('Sign.vue - signWithTokenCode', () => {
12081208
expect(wrapper.vm.needCreateSignature).toBe(false)
12091209
})
12101210

1211+
it('requires signature creation for envelope child elements even when parent signer id differs', async () => {
1212+
const { default: realSign } = await import('../../../views/SignPDF/_partials/Sign.vue')
1213+
const { useSignStore } = await import('../../../store/sign.js')
1214+
const { useSignatureElementsStore } = await import('../../../store/signatureElements.js')
1215+
1216+
const signStore = useSignStore()
1217+
const signatureElementsStore = useSignatureElementsStore()
1218+
1219+
signStore.document = createSignDocument({
1220+
nodeType: 'envelope',
1221+
signers: [
1222+
{ signRequestId: 700, me: true },
1223+
],
1224+
files: [
1225+
{
1226+
id: 10,
1227+
name: 'child-file',
1228+
signers: [
1229+
{ signRequestId: 501, me: true },
1230+
],
1231+
visibleElements: [
1232+
{ elementId: 201, fileId: 10, signRequestId: 501, type: 'signature', coordinates: { page: 1, left: 10, top: 20, width: 30, height: 40 } },
1233+
],
1234+
},
1235+
],
1236+
})
1237+
1238+
signatureElementsStore.signs.signature = {
1239+
id: 0,
1240+
type: '',
1241+
file: { url: '', nodeId: 0 },
1242+
starred: 0,
1243+
createdAt: '',
1244+
}
1245+
1246+
const wrapper = mount(realSign, {
1247+
global: {
1248+
stubs: {
1249+
NcButton: true,
1250+
NcDialog: true,
1251+
NcLoadingIcon: true,
1252+
TokenManager: true,
1253+
EmailManager: true,
1254+
UploadCertificate: true,
1255+
Documents: true,
1256+
Signatures: true,
1257+
Draw: true,
1258+
ManagePassword: true,
1259+
CreatePassword: true,
1260+
NcNoteCard: true,
1261+
NcPasswordField: true,
1262+
NcRichText: true,
1263+
},
1264+
mocks: {
1265+
$watch: vi.fn(),
1266+
},
1267+
},
1268+
})
1269+
1270+
expect(wrapper.vm.hasSignatures).toBe(false)
1271+
expect(wrapper.vm.needCreateSignature).toBe(true)
1272+
})
1273+
12111274
it('returns false for needCreateSignature when signer has no placed visibleElements (clickToSign scenario)', async () => {
12121275
// Regression: commit e9ea79495 removed visibleElements.some() check, causing
12131276
// needCreateSignature to return true for clickToSign documents where no visual

0 commit comments

Comments
 (0)