diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index f8b3fd55b..e80d50f5d 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1765,8 +1765,9 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], + ["input", "Validate"], ], - event => event.target.checked + event => event.target.value ); } else { selectElement.addEventListener("input", function (event) { diff --git a/test/integration/scripting_spec.js b/test/integration/scripting_spec.js index f335fc1b6..7fd854623 100644 --- a/test/integration/scripting_spec.js +++ b/test/integration/scripting_spec.js @@ -1854,4 +1854,43 @@ describe("Interaction", () => { ); }); }); + + describe("in issue16067.pdf", () => { + let pages; + + beforeAll(async () => { + pages = await loadAndWait("issue16067.pdf", getSelector("6R")); + }); + + afterAll(async () => { + await closePages(pages); + }); + + it("must check that a field has the correct value when a choice is changed", async () => { + await Promise.all( + pages.map(async ([browserName, page]) => { + await page.waitForFunction( + "window.PDFViewerApplication.scriptingReady === true" + ); + + let text = await page.$eval(getSelector("44R"), el => el.value); + expect(text).withContext(`In ${browserName}`).toEqual(""); + + await page.select(getSelector("6R"), "Yes"); + await page.waitForTimeout(10); + + text = await page.$eval(getSelector("44R"), el => el.value); + expect(text).withContext(`In ${browserName}`).toEqual("Yes"); + + await clearInput(page, getSelector("44R")); + + await page.select(getSelector("6R"), "No"); + await page.waitForTimeout(10); + + text = await page.$eval(getSelector("44R"), el => el.value); + expect(text).withContext(`In ${browserName}`).toEqual("No"); + }) + ); + }); + }); }); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 5ea4bb2de..86847a119 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -575,3 +575,4 @@ !issue16021.pdf !bug1770750.pdf !issue16063.pdf +!issue16067.pdf diff --git a/test/pdfs/issue16067.pdf b/test/pdfs/issue16067.pdf new file mode 100755 index 000000000..a5ef5a3a5 Binary files /dev/null and b/test/pdfs/issue16067.pdf differ