1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Construct the correct field name and strip out classes when searching

The classes were stripped out during when creating the field name but
it led to a wrong name.
Since class components in a path are irrelevant, they're just ignored
when searching for a node in the datasets.
This commit is contained in:
Calixte Denizet 2023-09-07 15:52:58 +02:00
parent cf5a1d60a6
commit a8a50c567a
3 changed files with 18 additions and 6 deletions

View file

@ -2037,6 +2037,7 @@ describe("api", function () {
const value = "Hello World";
pdfDoc.annotationStorage.setValue("2055R", { value });
pdfDoc.annotationStorage.setValue("2090R", { value });
const data = await pdfDoc.saveDocument();
await loadingTask.destroy();
@ -2051,6 +2052,17 @@ describe("api", function () {
);
expect(surName.nodeValue).toEqual(value);
// The path for the date is:
// PPTC_153[0].Page1[0].DeclerationAndSignatures[0]
// .#subform[2].currentDate[0]
// and it contains a class (i.e. #subform[2]) which is irrelevant in the
// context of datasets (it's more a template concept).
const date = getNamedNodeInXML(
datasets.node,
"xfa:data.PPTC_153.Page1.DeclerationAndSignatures.currentDate.#text"
);
expect(date.nodeValue).toEqual(value);
await loadingTask.destroy();
});