fix(overlays): return promises for toggle open and close methods
This commit is contained in:
parent
de536282e1
commit
11e8dbcbfe
3 changed files with 13 additions and 6 deletions
5
.changeset/purple-beers-applaud.md
Normal file
5
.changeset/purple-beers-applaud.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@lion/overlays': patch
|
||||
---
|
||||
|
||||
Return promises for the OverlayMixin toggle, open and close methods, since the OverlayController hiding/showing is asynchronous.
|
||||
|
|
@ -325,22 +325,22 @@ export const OverlayMixinImplementation = superclass =>
|
|||
/**
|
||||
* Toggles the overlay
|
||||
*/
|
||||
toggle() {
|
||||
/** @type {OverlayController} */ (this._overlayCtrl).toggle();
|
||||
async toggle() {
|
||||
await /** @type {OverlayController} */ (this._overlayCtrl).toggle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the overlay
|
||||
*/
|
||||
open() {
|
||||
/** @type {OverlayController} */ (this._overlayCtrl).show();
|
||||
async open() {
|
||||
await /** @type {OverlayController} */ (this._overlayCtrl).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the overlay
|
||||
*/
|
||||
close() {
|
||||
/** @type {OverlayController} */ (this._overlayCtrl).hide();
|
||||
async close() {
|
||||
await /** @type {OverlayController} */ (this._overlayCtrl).hide();
|
||||
}
|
||||
};
|
||||
export const OverlayMixin = dedupeMixin(OverlayMixinImplementation);
|
||||
|
|
|
|||
|
|
@ -920,9 +920,11 @@ describe('OverlayController', () => {
|
|||
expect(ctrl2.content).to.be.displayed;
|
||||
|
||||
await ctrl3.show();
|
||||
await ctrl3._showComplete;
|
||||
expect(ctrl3.content).to.be.displayed;
|
||||
|
||||
await ctrl2.hide();
|
||||
await ctrl2._hideComplete;
|
||||
expect(ctrl0.content).to.be.displayed;
|
||||
expect(ctrl1.content).to.be.displayed;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue