mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #13570 from calixteman/xfa_field
XFA - By default a text ui has only one line when in a field element
This commit is contained in:
commit
335d4cb2fc
4 changed files with 69 additions and 7 deletions
1
test/pdfs/xfa_bug1716809.pdf.link
Normal file
1
test/pdfs/xfa_bug1716809.pdf.link
Normal file
|
@ -0,0 +1 @@
|
|||
https://bugzilla.mozilla.org/attachment.cgi?id=9227437
|
|
@ -938,6 +938,14 @@
|
|||
"enableXfa": true,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "xfa_bug1716809",
|
||||
"file": "pdfs/xfa_bug1716809.pdf",
|
||||
"md5": "7192f9e27e8b84776d107f57cbe353d5",
|
||||
"link": true,
|
||||
"rounds": 1,
|
||||
"enableXfa": true,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "xfa_annual_expense_report",
|
||||
"file": "pdfs/xfa_annual_expense_report.pdf",
|
||||
"md5": "06866e7a6bbc0346789208ef5f6e885c",
|
||||
|
|
|
@ -137,7 +137,7 @@ describe("XFAFactory", function () {
|
|||
<medium stock="default" short="456pt" long="789pt"/>
|
||||
<field y="1pt" w="11pt" h="22pt" x="2pt">
|
||||
<ui>
|
||||
<textEdit/>
|
||||
<textEdit multiLine="0"/>
|
||||
</ui>
|
||||
<value>
|
||||
<text maxChars="123"/>
|
||||
|
@ -160,9 +160,54 @@ describe("XFAFactory", function () {
|
|||
expect(factory.numberPages).toEqual(1);
|
||||
|
||||
const pages = factory.getPages();
|
||||
const field = searchHtmlNode(pages, "name", "textarea");
|
||||
const field = searchHtmlNode(pages, "name", "input");
|
||||
|
||||
expect(field.attributes.maxLength).toEqual(123);
|
||||
});
|
||||
|
||||
it("should have an input or textarea", function () {
|
||||
const xml = `
|
||||
<?xml version="1.0"?>
|
||||
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
|
||||
<template xmlns="http://www.xfa.org/schema/xfa-template/3.3">
|
||||
<subform name="root" mergeMode="matchTemplate">
|
||||
<pageSet>
|
||||
<pageArea>
|
||||
<contentArea x="123pt" w="456pt" h="789pt"/>
|
||||
<medium stock="default" short="456pt" long="789pt"/>
|
||||
<field y="1pt" w="11pt" h="22pt" x="2pt">
|
||||
<ui>
|
||||
<textEdit/>
|
||||
</ui>
|
||||
</field>
|
||||
<field y="1pt" w="11pt" h="22pt" x="2pt">
|
||||
<ui>
|
||||
<textEdit multiLine="1"/>
|
||||
</ui>
|
||||
</field>
|
||||
</pageArea>
|
||||
</pageSet>
|
||||
<subform name="first">
|
||||
<draw><value><text>foo</text></value></draw>
|
||||
</subform>
|
||||
</subform>
|
||||
</template>
|
||||
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
|
||||
<xfa:data>
|
||||
</xfa:data>
|
||||
</xfa:datasets>
|
||||
</xdp:xdp>
|
||||
`;
|
||||
const factory = new XFAFactory({ "xdp:xdp": xml });
|
||||
|
||||
expect(factory.numberPages).toEqual(1);
|
||||
|
||||
const pages = factory.getPages();
|
||||
const field1 = searchHtmlNode(pages, "name", "input");
|
||||
expect(field1).not.toEqual(null);
|
||||
|
||||
const field2 = searchHtmlNode(pages, "name", "textarea");
|
||||
expect(field2).not.toEqual(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue