summaryrefslogtreecommitdiffstats
path: root/dom/html/test/forms/test_input_datetime_focus_blur.html
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-14 14:41:19 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-14 14:41:19 +0100
commit8a15fd8d24e4373f462046b46fbe8558f57f3403 (patch)
tree9c485d6b346a2fed8aaa14fbb154046296d22b7a /dom/html/test/forms/test_input_datetime_focus_blur.html
parent34125a031ed9c7814d2145070294ead44b7504b3 (diff)
downloadUXP-8a15fd8d24e4373f462046b46fbe8558f57f3403.tar
UXP-8a15fd8d24e4373f462046b46fbe8558f57f3403.tar.gz
UXP-8a15fd8d24e4373f462046b46fbe8558f57f3403.tar.lz
UXP-8a15fd8d24e4373f462046b46fbe8558f57f3403.tar.xz
UXP-8a15fd8d24e4373f462046b46fbe8558f57f3403.zip
Bug 1286182: Implement the layout for <input type=date>
Diffstat (limited to 'dom/html/test/forms/test_input_datetime_focus_blur.html')
-rw-r--r--dom/html/test/forms/test_input_datetime_focus_blur.html28
1 files changed, 18 insertions, 10 deletions
diff --git a/dom/html/test/forms/test_input_datetime_focus_blur.html b/dom/html/test/forms/test_input_datetime_focus_blur.html
index 5b8d95b25..85f7b4bb4 100644
--- a/dom/html/test/forms/test_input_datetime_focus_blur.html
+++ b/dom/html/test/forms/test_input_datetime_focus_blur.html
@@ -4,7 +4,7 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
-->
<head>
- <title>Test focus/blur behaviour for &lt;input type='time'&gt;</title>
+ <title>Test focus/blur behaviour for date/time input types</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
@@ -12,7 +12,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1288591">Mozilla Bug 1288591</a>
<p id="display"></p>
<div id="content">
- <input id="input" type="time">
+ <input id="input_time" type="time">
+ <input id="input_date" type="date">
</div>
<pre id="test">
<script type="application/javascript">
@@ -30,15 +31,15 @@ SimpleTest.waitForFocus(function() {
SimpleTest.finish();
});
-function test() {
- let time = document.getElementById("input");
- time.focus();
+function testFocusBlur(type) {
+ let input = document.getElementById("input_" + type);
+ input.focus();
- // The active element returns the input type=time.
+ // The active element returns the date/time input element.
let activeElement = document.activeElement;
- is(activeElement, time, "activeElement should be the time element");
+ is(activeElement, input, "activeElement should be the date/time input element");
is(activeElement.localName, "input", "activeElement should be an input element");
- is(activeElement.type, "time", "activeElement should be of type time");
+ is(activeElement.type, type, "activeElement should be of type " + type);
// Use FocusManager to check that the actual focus is on the anonymous
// text control.
@@ -48,10 +49,17 @@ function test() {
is(focusedElement.localName, "input", "focusedElement should be an input element");
is(focusedElement.type, "text", "focusedElement should be of type text");
- time.blur();
- isnot(document.activeElement, time, "activeElement should no longer be the time element");
+ input.blur();
+ isnot(document.activeElement, input, "activeElement should no longer be the datetime input element");
}
+function test() {
+ let inputTypes = ["time", "date"];
+
+ for (let i = 0; i < inputTypes.length; i++) {
+ testFocusBlur(inputTypes[i]);
+ }
+}
</script>
</pre>
</body>