mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 01:29:05 +01:00
Get Et2Date & Et2DateTime tests passing again
This commit is contained in:
parent
933d13c8b2
commit
15f986cf1a
@ -26,6 +26,7 @@ import {LitFlatpickr} from "lit-flatpickr";
|
||||
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
||||
import shoelace from "../Styles/shoelace";
|
||||
|
||||
const textbox = new Et2Textbox();
|
||||
const button = new Et2ButtonIcon();
|
||||
// Request this year's holidays now
|
||||
holidays(new Date().getFullYear());
|
||||
@ -454,6 +455,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
|
||||
// Wait for everything to be there before we start flatpickr
|
||||
await this.updateComplete;
|
||||
await this._inputNode.updateComplete;
|
||||
this._inputNode.requestUpdate();
|
||||
await this._inputNode.updateComplete;
|
||||
|
||||
@ -706,10 +708,10 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
// If they typed a valid date/time, try to update flatpickr
|
||||
if(parsedDate)
|
||||
{
|
||||
const formattedDate = this._instance.formatDate(parsedDate, this.getOptions().altFormat)
|
||||
const formattedDate = flatpickr.formatDate(parsedDate, this.getOptions().altFormat)
|
||||
if(value === formattedDate &&
|
||||
// Avoid infinite loop of setting the same value back triggering another change
|
||||
this._instance.input.value !== this._instance.formatDate(parsedDate, this.getOptions().dateFormat))
|
||||
this._instance.input.value !== flatpickr.formatDate(parsedDate, this.getOptions().dateFormat))
|
||||
{
|
||||
this._instance.setDate(value, true, this._instance.config.altFormat)
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ async function before()
|
||||
<et2-date label="I'm a date"></et2-date>
|
||||
`);
|
||||
|
||||
await element.updateComplete;
|
||||
|
||||
return element;
|
||||
};
|
||||
|
||||
|
@ -30,13 +30,7 @@ describe("DateTime widget", () =>
|
||||
<et2-date-time label="I'm a date-time"></et2-date-time>
|
||||
`);
|
||||
|
||||
// Create an element to test with, and wait until it's ready
|
||||
// @ts-ignore
|
||||
element = await fixture<Et2DateTime>(html`
|
||||
<et2-date-time label="I'm a date-time"></et2-date-time>
|
||||
`);
|
||||
|
||||
|
||||
await element.updateComplete;
|
||||
});
|
||||
|
||||
// Make sure it works
|
||||
@ -54,7 +48,7 @@ describe("DateTime widget", () =>
|
||||
|
||||
it('Readonly does not return a value', async() =>
|
||||
{
|
||||
element.readOnly = true;
|
||||
element.readonly = true;
|
||||
let test_time_string = '2008-09-22T12:00:00.000Z';
|
||||
|
||||
element.set_value(test_time_string);
|
||||
|
Loading…
Reference in New Issue
Block a user