blob: b4b7ce2c0b166eb3cde8c11ff7cea266ba0453ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<!DOCTYPE html>
<title>Test for bug 1772841</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1772841">Mozilla Bug 1772841</a>
<div id="content">
<input type="date" id="date" disabled>
<input type="time" id="time" disabled>
<input type="datetime-local" id="datetime-local" disabled>
<input type="date" id="date1">
<input type="time" id="time1">
<input type="datetime-local" id="datetime-local1">
</div>
<script>
/*
* Test for bug 1772841
* This test checks that when a datetime input element is disabled,
* it should not be focusable by click.
**/
add_task(async function() {
await SimpleTest.promiseFocus(window);
for (let inputType of ["time", "date", "datetime-local"]) {
testFocusState(inputType);
testDynamicChange(inputType);
}
})
function testFocusState(inputType) {
let input = document.getElementById(inputType);
input.click();
isnot(document.activeElement, input, "disabled element should not be focusable by click");
synthesizeMouseAtCenter(input, {});
isnot(document.activeElement, input, "disabled element should not be focusable by click");
}
function testDynamicChange(inputType) {
document.getElementById(inputType + "1").disabled = true;
testFocusState(inputType + "1");
}
</script>
|