mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-08 12:19:05 +02:00
Ensuring that the date input within a main browser is not loosing focus when its associate date picker panel is opened and that the focus is udpated accordingly when it is closed (main part of the patch was crafted by Emilio, tests are added by ayeddi). Differential Revision: https://phabricator.services.mozilla.com/D167698
33 lines
839 B
JavaScript
33 lines
839 B
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* Test that date picker opens with showPicker.
|
|
*/
|
|
add_task(async function test_datepicker_showPicker() {
|
|
const date = new Date();
|
|
|
|
await helper.openPicker(
|
|
"data:text/html, <input type='date'>",
|
|
false,
|
|
"showPicker"
|
|
);
|
|
|
|
if (date.getMonth() === new Date().getMonth()) {
|
|
Assert.equal(
|
|
helper.getElement(MONTH_YEAR).textContent,
|
|
DATE_FORMAT_LOCAL(date),
|
|
"Date picker opens when a showPicker method is called"
|
|
);
|
|
} else {
|
|
Assert.ok(
|
|
true,
|
|
"Skipping datepicker today test if month changes when opening picker."
|
|
);
|
|
}
|
|
|
|
await helper.tearDown();
|
|
});
|