diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /toolkit/components/reader/tests/chrome | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/reader/tests/chrome')
-rw-r--r-- | toolkit/components/reader/tests/chrome/chrome.toml | 2 | ||||
-rw-r--r-- | toolkit/components/reader/tests/chrome/test_moz_slider.html | 48 |
2 files changed, 50 insertions, 0 deletions
diff --git a/toolkit/components/reader/tests/chrome/chrome.toml b/toolkit/components/reader/tests/chrome/chrome.toml index e416c49181..2697e13db8 100644 --- a/toolkit/components/reader/tests/chrome/chrome.toml +++ b/toolkit/components/reader/tests/chrome/chrome.toml @@ -1,3 +1,5 @@ [DEFAULT] ["test_color_input.html"] + +["test_moz_slider.html"] diff --git a/toolkit/components/reader/tests/chrome/test_moz_slider.html b/toolkit/components/reader/tests/chrome/test_moz_slider.html new file mode 100644 index 0000000000..01af33ed14 --- /dev/null +++ b/toolkit/components/reader/tests/chrome/test_moz_slider.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>MozSlider Tests</title> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + <script type="module" src="chrome://global/content/reader/moz-slider.mjs"></script> +</head> +<body> +<p id="display"></p> +<div id="content" style="max-width: fit-content"> + <moz-slider min="0" max="3" value="2" ticks="7" ticklabels='["Narrow", "Wide"]'></moz-slider> +</div> +<pre id="test"> +<script class="testbody" type="application/javascript"> + add_task(async function testMozSliderDisplay() { + const mozSlider = document.querySelector("moz-slider"); + ok(mozSlider, "moz-slider is rendered"); + is(mozSlider.value, 2, "moz-slider should set initial value based on prop"); + + const ticks = mozSlider.tickMarks; + ok(ticks, "moz-slider contains tick marks"); + is(ticks.childElementCount, 7, "should have the correct number of ticks"); + }); + + add_task(async function testMozSliderValues() { + const mozSlider = document.querySelector("moz-slider"); + const firstVal = mozSlider.value; + + const sliderChanged = new Promise((resolve) => { + mozSlider.addEventListener("slider-changed", (event) => resolve(event.detail), { once: true }); + }); + mozSlider.sliderTrack.focus(); + synthesizeKey("KEY_ArrowRight"); + await sliderChanged; + ok(mozSlider.value > firstVal, "moving slider to the right should increase value"); + is(mozSlider.value - firstVal, 0.5, "should increment by correct step size"); + + synthesizeKey("KEY_ArrowRight", { repeat: 2 }); + await sliderChanged; + ok(mozSlider.value == 3, "should not increment beyond max value"); + }); +</script> +</pre> +</body> +</html> |