Use the string value of the field when calling the Format callback (bug 1889122)

This commit is contained in:
Calixte Denizet 2024-04-03 22:24:17 +02:00
parent 25f6a0c139
commit b643c0fcfb
6 changed files with 85 additions and 3 deletions

View file

@ -27,6 +27,7 @@ import {
loadAndWait,
scrollIntoView,
waitForEntryInStorage,
waitForSandboxTrip,
waitForTimeout,
} from "./test_utils.mjs";
@ -2367,4 +2368,41 @@ describe("Interaction", () => {
);
});
});
describe("Textfield with a zip code starting with 0", () => {
let pages;
let otherPages;
beforeAll(async () => {
otherPages = await Promise.all(
global.integrationSessions.map(async session =>
session.browser.newPage()
)
);
pages = await loadAndWait("bug1889122.pdf", getSelector("24R"));
});
afterAll(async () => {
await closePages(pages);
await Promise.all(otherPages.map(page => page.close()));
});
it("must check the zip code is correctly formatted", async () => {
await Promise.all(
pages.map(async ([browserName, page], i) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
await page.click(getSelector("24R"));
await page.type(getSelector("24R"), "01234", { delay: 10 });
await page.keyboard.press("Tab");
await waitForSandboxTrip(page);
const text = await page.$eval(getSelector("24R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("01234");
})
);
});
});
});