mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #12838 from calixteman/authors
[api-minor] Change the "dc:creator" Metadata field to an Array
This commit is contained in:
commit
1de1ae0be6
10 changed files with 97 additions and 33 deletions
|
@ -451,4 +451,29 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in js-authors.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("js-authors.pdf", "#\\32 5R");
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must print authors in a text field", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const text = await actAndWaitForInput(page, "#\\32 5R", async () => {
|
||||
await page.click("[data-annotation-id='26R']");
|
||||
});
|
||||
expect(text)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual("author1::author2::author3::author4::author5");
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -325,6 +325,7 @@
|
|||
!tensor-allflags-withfunction.pdf
|
||||
!issue10084_reduced.pdf
|
||||
!issue4246.pdf
|
||||
!js-authors.pdf
|
||||
!issue4461.pdf
|
||||
!issue4573.pdf
|
||||
!issue4722.pdf
|
||||
|
|
BIN
test/pdfs/js-authors.pdf
Normal file
BIN
test/pdfs/js-authors.pdf
Normal file
Binary file not shown.
|
@ -96,7 +96,7 @@ describe("metadata", function () {
|
|||
expect(metadata.get("dc:qux")).toEqual(null);
|
||||
|
||||
expect(metadata.getAll()).toEqual({
|
||||
"dc:creator": "ODIS",
|
||||
"dc:creator": ["ODIS"],
|
||||
"dc:title": "L'Odissee thématique logo Odisséé - décembre 2008.pub",
|
||||
"xap:creatortool": "PDFCreator Version 0.9.6",
|
||||
});
|
||||
|
@ -168,7 +168,7 @@ describe("metadata", function () {
|
|||
expect(metadata.get("dc:qux")).toEqual(null);
|
||||
|
||||
expect(metadata.getAll()).toEqual({
|
||||
"dc:creator": "",
|
||||
"dc:creator": [""],
|
||||
"dc:description": "",
|
||||
"dc:format": "application/pdf",
|
||||
"dc:subject": "",
|
||||
|
|
|
@ -47,8 +47,9 @@ describe("XML", function () {
|
|||
<g a="121110"/>
|
||||
</b>
|
||||
</a>`;
|
||||
const root = new SimpleXMLParser(true).parseFromString(xml)
|
||||
.documentElement;
|
||||
const root = new SimpleXMLParser({ hasAttributes: true }).parseFromString(
|
||||
xml
|
||||
).documentElement;
|
||||
function getAttr(path) {
|
||||
return root.searchNode(parseXFAPath(path), 0).attributes[0].value;
|
||||
}
|
||||
|
@ -96,8 +97,9 @@ describe("XML", function () {
|
|||
<g a="121110"/>
|
||||
</b>
|
||||
</a>`;
|
||||
const root = new SimpleXMLParser(true).parseFromString(xml)
|
||||
.documentElement;
|
||||
const root = new SimpleXMLParser({ hasAttributes: true }).parseFromString(
|
||||
xml
|
||||
).documentElement;
|
||||
const buffer = [];
|
||||
root.dump(buffer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue