1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

Remove terminal white spaces when extracting text from annotation appearances

This commit is contained in:
Calixte Denizet 2024-01-08 18:33:36 +01:00
parent 29faa38dd7
commit 0392feaee4
5 changed files with 46 additions and 3 deletions

View file

@ -33,6 +33,7 @@ async function runTests(results) {
"ink_editor_spec.mjs",
"scripting_spec.mjs",
"stamp_editor_spec.mjs",
"text_field_spec.mjs",
],
});

View file

@ -0,0 +1,39 @@
/* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { closePages, getSelector, loadAndWait } from "./test_utils.mjs";
describe("Text field", () => {
describe("Empty text field", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("file_pdfjs_form.pdf", getSelector("7R"));
});
afterAll(async () => {
await closePages(pages);
});
it("must check that the field is empty although its appearance contains a white space", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const text = await page.$eval(getSelector("7R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("");
})
);
});
});
});

View file

@ -623,3 +623,4 @@
!bug1872721.pdf
!bug1871353.pdf
!bug1871353.1.pdf
!file_pdfjs_form.pdf

BIN
test/pdfs/file_pdfjs_form.pdf Executable file

Binary file not shown.