Fix public holiday picker, add some tests, see #902
This commit is contained in:
parent
1773f851d1
commit
f99685c47d
2 changed files with 29 additions and 3 deletions
|
@ -26,6 +26,20 @@ export default class PublicHolidayInput extends InputElement<string> {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* // should construct an element
|
||||
* const html = new PublicHolidayInput().InnerConstructElement()
|
||||
* html !== undefined // => true
|
||||
*
|
||||
* // should construct an element despite having an invalid input
|
||||
* const html = new PublicHolidayInput(new UIEventSource("invalid")).InnerConstructElement()
|
||||
* html !== undefined // => true
|
||||
*
|
||||
* // should construct an element despite having null as input
|
||||
* const html = new PublicHolidayInput(new UIEventSource(null)).InnerConstructElement()
|
||||
* html !== undefined // => true
|
||||
*/
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
const dropdown = new DropDown(
|
||||
Translations.t.general.opening_hours.open_during_ph.Clone(),
|
||||
|
@ -75,6 +89,9 @@ export default class PublicHolidayInput extends InputElement<string> {
|
|||
const value = this._value;
|
||||
value.map(ph => OH.ParsePHRule(ph))
|
||||
.addCallbackAndRunD(parsed => {
|
||||
if(parsed === null){
|
||||
return
|
||||
}
|
||||
mode.setData(parsed.mode)
|
||||
startTime.setData(parsed.start)
|
||||
endTime.setData(parsed.end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue