Skip to content

Commit

Permalink
fix: use correct event to detect overlay closing (#4340) (#4342)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Aug 11, 2022
1 parent 6450888 commit 5ec9ca4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/date-picker/src/vaadin-date-picker-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
fullscreen$="[[_fullscreen]]"
opened="{{opened}}"
on-vaadin-overlay-open="_onOverlayOpened"
on-vaadin-overlay-close="_onOverlayClosed"
on-vaadin-overlay-closing="_onOverlayClosed"
restore-focus-on-close
restore-focus-node="[[inputElement]]"
theme$="[[__getOverlayTheme(_theme, _overlayInitialized)]]"
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/vaadin-date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
fullscreen$="[[_fullscreen]]"
theme$="[[__getOverlayTheme(_theme, _overlayInitialized)]]"
on-vaadin-overlay-open="_onOverlayOpened"
on-vaadin-overlay-close="_onOverlayClosed"
on-vaadin-overlay-closing="_onOverlayClosed"
restore-focus-on-close
restore-focus-node="[[inputElement]]"
disable-upgrade
Expand Down
7 changes: 7 additions & 0 deletions packages/date-picker/test/form-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ describe('form input', () => {
expect(datepicker.inputElement.hasAttribute('invalid')).to.be.true;
});

it('should not validate on input click while opened', async () => {
await open(datepicker);
const spy = sinon.spy(datepicker, 'validate');
datepicker.inputElement.click();
expect(spy.called).to.be.false;
});

it('should re-validate old input after selecting date', async () => {
// Set invalid value.
inputValue('foo');
Expand Down

0 comments on commit 5ec9ca4

Please sign in to comment.