53 lines
1.3 KiB
HTML
53 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<script src="../../resources/js-test.js"></script>
|
|
<script>
|
|
|
|
description('This tests listeners on MediaQueryList get called when contrast settings are turned on when there are no relevant style rules');
|
|
|
|
jsTestIsAsync = true;
|
|
|
|
if (window.testRunner)
|
|
testRunner.waitUntilDone();
|
|
|
|
let didCallListener = false;
|
|
let timer;
|
|
|
|
window.onload = () => {
|
|
requestAnimationFrame(() => {
|
|
window.matchMedia('(prefers-contrast)').addListener((e) => {
|
|
didCallListener = true;
|
|
finalize();
|
|
});
|
|
|
|
if (!window.internals || !testRunner.runUIScript) {
|
|
testFailed('This test requires runUIScript');
|
|
finishJSTest();
|
|
return;
|
|
}
|
|
|
|
window.internals.settings.forcedPrefersContrastAccessibilityValue = "on";
|
|
testRunner.runUIScript(`
|
|
uiController.simulateAccessibilitySettingsChangeNotification(() => {
|
|
uiController.uiScriptComplete("Done");
|
|
})`, () => {
|
|
if (!didCallListener)
|
|
timer = setTimeout(finalize, 1000);
|
|
});
|
|
});
|
|
}
|
|
|
|
function finalize() {
|
|
if (timer)
|
|
clearTimeout(timer);
|
|
|
|
shouldBeTrue('didCallListener');
|
|
shouldBeTrue('matchMedia("(prefers-contrast)").matches');
|
|
finishJSTest();
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|