mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
Bug 1401876 - (Part 2) Add browser-chrome test for reopening picker
This commit is contained in:
parent
e75b329d4d
commit
1cb68033a6
2 changed files with 27 additions and 1 deletions
|
|
@ -167,6 +167,28 @@ add_task(async function test_datepicker_clicked() {
|
||||||
await helper.tearDown();
|
await helper.tearDown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure picker is in correct state when it is reopened.
|
||||||
|
*/
|
||||||
|
add_task(async function test_datepicker_reopen_state() {
|
||||||
|
const inputValue = "2016-12-15";
|
||||||
|
const nextMonth = "2017-01-01";
|
||||||
|
|
||||||
|
await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
|
||||||
|
// Navigate to the next month but does not commit the change
|
||||||
|
Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
|
||||||
|
helper.click(helper.getElement(BTN_NEXT_MONTH));
|
||||||
|
Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth)));
|
||||||
|
EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
|
||||||
|
|
||||||
|
// Ensures the picker opens to the month of the input value
|
||||||
|
await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser);
|
||||||
|
await helper.waitForPickerReady();
|
||||||
|
Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
|
||||||
|
|
||||||
|
await helper.tearDown();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When min and max attributes are set, calendar should show some dates as
|
* When min and max attributes are set, calendar should show some dates as
|
||||||
* out-of-range.
|
* out-of-range.
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,12 @@ class DateTimeTestHelper {
|
||||||
await BrowserTestUtils.waitForEvent(this.panel, "DateTimePickerBindingReady")
|
await BrowserTestUtils.waitForEvent(this.panel, "DateTimePickerBindingReady")
|
||||||
}
|
}
|
||||||
this.frame = this.panel.dateTimePopupFrame;
|
this.frame = this.panel.dateTimePopupFrame;
|
||||||
|
await this.waitForPickerReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForPickerReady() {
|
||||||
await BrowserTestUtils.waitForEvent(this.frame, "load", true);
|
await BrowserTestUtils.waitForEvent(this.frame, "load", true);
|
||||||
// Wait for picker elements to be ready and open panel transition to end
|
// Wait for picker elements to be ready
|
||||||
await BrowserTestUtils.waitForEvent(this.frame.contentDocument, "PickerReady");
|
await BrowserTestUtils.waitForEvent(this.frame.contentDocument, "PickerReady");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue