Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion tests/browser/composer_duration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,31 @@ try {
await decimalTrigger.click();
const decimalPopup = page.getByRole("dialog", { name: dialogName, exact: true });
const decimalInput = decimalPopup.getByLabel(inputName, { exact: true });
const decimalSlider = decimalPopup.getByRole("slider");
const minimum = Number(await decimalInput.getAttribute("min"));
const maximum = Number(await decimalInput.getAttribute("max"));
assert.ok(Number.isFinite(minimum) && maximum > minimum);
const notice = decimalPopup.locator(".cw-duration-notice");
for (const [key, endpoint, outside] of [
["Home", minimum, minimum - 1],
["End", maximum, maximum + 1],
]) {
await decimalSlider.press(key);
assert.equal(await decimalInput.inputValue(), String(endpoint), locale);
assert.equal(await notice.count(), 0, locale);
await decimalInput.fill(String(outside));
await decimalInput.press("Enter");
await notice.waitFor({ state: "visible" });
assert.equal(await decimalInput.inputValue(), String(endpoint), locale);
// A valid endpoint clears an existing warning immediately.
await decimalSlider.press(key);
assert.equal(await notice.count(), 0, locale);
}
await decimalInput.fill("15");
await decimalInput.press("Enter");
if (decimalConfig.id === h3Config.id)
assert.match(await decimalPopup.locator(".cw-duration-output").innerText(), /362.*15\.083333/);
assert.equal(await decimalPopup.locator(".cw-duration-notice").count(), 0);
const decimalSlider = decimalPopup.getByRole("slider");
assert.equal(await decimalSlider.getAttribute("step"), "1");
const dragBox = await decimalSlider.boundingBox();
await page.mouse.move(dragBox.x + dragBox.width / 2, dragBox.y + dragBox.height / 2);
Expand Down
15 changes: 13 additions & 2 deletions tests/browser/control_theme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,25 @@ try {
".cw-duration-popover",
"portaled duration picker",
);
await light(duration.locator(".cw-duration-number input"), "duration input");
const durationInput = await light(
duration.locator(".cw-duration-number input"),
"duration input",
);
const maximum = Number(await durationInput.getAttribute("max"));
assert.ok(Number.isFinite(maximum) && maximum > 0);
const slider = duration.getByRole("slider");
const trackAccent = await slider.evaluate((el) =>
getComputedStyle(el).getPropertyValue("--cw-control-accent").trim(),
);
assert.equal(trackAccent, "#3d6bd6");
await slider.press("End");
await light(".cw-duration-notice", "duration boundary hint");
assert.equal(await durationInput.inputValue(), String(maximum));
assert.equal(await duration.locator(".cw-duration-notice").count(), 0);
// End chooses a valid endpoint. Exercise warning styling with invalid input.
await durationInput.fill(String(maximum + 1));
await durationInput.press("Enter");
await light(duration.locator(".cw-duration-notice"), "duration range warning");
assert.equal(await durationInput.inputValue(), String(maximum));
if (process.env.THEME_SCREENSHOT_DIR)
await page.screenshot({
path: `${process.env.THEME_SCREENSHOT_DIR}/duration-light.png`,
Expand Down
Loading