Skip to content

Commit f410432

Browse files
Merge pull request #20338 from calixteman/test_date_tz
Add a test for PR #20320
2 parents 7f92a6e + 25ce140 commit f410432

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

test/integration/scripting_spec.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,56 @@ describe("Interaction", () => {
25852585
});
25862586
});
25872587

2588+
describe("Date HTML element in different timezone", () => {
2589+
let pages;
2590+
2591+
beforeEach(async () => {
2592+
pages = await loadAndWait(
2593+
"dates.pdf",
2594+
getAnnotationSelector("26R"),
2595+
null,
2596+
null,
2597+
async page => {
2598+
// Make sure that 00:00 UTC is the day before in the local timezone.
2599+
await page.emulateTimezone("Pacific/Niue");
2600+
}
2601+
);
2602+
});
2603+
2604+
afterEach(async () => {
2605+
await closePages(pages);
2606+
});
2607+
2608+
it("must check that the inputs are correct", async () => {
2609+
await Promise.all(
2610+
pages.map(async ([browserName, page]) => {
2611+
await waitForScripting(page);
2612+
await waitForSandboxTrip(page);
2613+
2614+
const firstInputSelector = `${getAnnotationSelector("26R")} > input`;
2615+
await page.waitForSelector(`${firstInputSelector}[type="text"]`);
2616+
await page.click(firstInputSelector);
2617+
await waitForSandboxTrip(page);
2618+
await page.waitForSelector(`${firstInputSelector}[type="date"]`);
2619+
await page.$eval(firstInputSelector, el => {
2620+
el.value = "2025-10-05";
2621+
});
2622+
const secondInputSelector = `${getAnnotationSelector("27R")} > input`;
2623+
await page.waitForSelector(`${secondInputSelector}[type="text"]`);
2624+
await page.click(secondInputSelector);
2625+
await waitForSandboxTrip(page);
2626+
const firstInputValue = await page.$eval(
2627+
firstInputSelector,
2628+
el => el.value
2629+
);
2630+
expect(firstInputValue)
2631+
.withContext(`In ${browserName}`)
2632+
.toEqual("05-Oct-25");
2633+
})
2634+
);
2635+
});
2636+
});
2637+
25882638
describe("Date HTML element with initial values", () => {
25892639
let pages;
25902640

test/integration/test_utils.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function loadAndWait(filename, selector, zoom, setups, options, viewport) {
4949
: options;
5050

5151
// Options must be handled in app.js::_parseHashParams.
52-
for (const [key, value] of Object.entries(optionsObject)) {
52+
for (const [key, value] of Object.entries(optionsObject || {})) {
5353
app_options += `&${key}=${encodeURIComponent(value)}`;
5454
}
5555
}

0 commit comments

Comments
 (0)