fix(datepicker): close with outside click (#386)
This commit is contained in:
parent
3abb65da33
commit
b34b399e17
2 changed files with 15 additions and 1 deletions
|
|
@ -264,6 +264,7 @@ export class LionInputDatepicker extends OverlayMixin(LionInputDate) {
|
||||||
contentNode,
|
contentNode,
|
||||||
invokerNode,
|
invokerNode,
|
||||||
elementToFocusAfterHide: invokerNode,
|
elementToFocusAfterHide: invokerNode,
|
||||||
|
hidesOnOutsideClick: true,
|
||||||
});
|
});
|
||||||
return ctrl;
|
return ctrl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { expect, fixture, defineCE } from '@open-wc/testing';
|
import { expect, fixture, defineCE, aTimeout } from '@open-wc/testing';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { html, LitElement } from '@lion/core';
|
import { html, LitElement } from '@lion/core';
|
||||||
import { MaxDate, MinDate, MinMaxDate, IsDateDisabled } from '@lion/validate';
|
import { MaxDate, MinDate, MinMaxDate, IsDateDisabled } from '@lion/validate';
|
||||||
|
|
@ -99,6 +99,19 @@ describe('<lion-input-datepicker>', () => {
|
||||||
expect(elObj.overlayController.isShown).to.equal(false);
|
expect(elObj.overlayController.isShown).to.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('closes the calendar via outside click', async () => {
|
||||||
|
const el = await fixture(html`
|
||||||
|
<lion-input-datepicker></lion-input-datepicker>
|
||||||
|
`);
|
||||||
|
const elObj = new DatepickerInputObject(el);
|
||||||
|
await elObj.openCalendar();
|
||||||
|
expect(elObj.overlayController.isShown).to.equal(true);
|
||||||
|
|
||||||
|
document.body.click();
|
||||||
|
await aTimeout();
|
||||||
|
expect(elObj.overlayController.isShown).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not in scope:
|
* Not in scope:
|
||||||
* - centralDate can be overridden
|
* - centralDate can be overridden
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue