@lion/overlays
Advanced tools
Comparing version 0.16.6 to 0.16.7
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.16.7](https://github.com/ing-bank/lion/compare/@lion/overlays@0.16.6...@lion/overlays@0.16.7) (2020-07-06) | ||
**Note:** Version bump only for package @lion/overlays | ||
## [0.16.6](https://github.com/ing-bank/lion/compare/@lion/overlays@0.16.5...@lion/overlays@0.16.6) (2020-06-24) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@lion/overlays", | ||
"version": "0.16.6", | ||
"version": "0.16.7", | ||
"description": "Overlays System using lit-html for rendering", | ||
@@ -46,3 +46,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "8b2736f23492787c00b7be52a32e034361201b10" | ||
"gitHead": "e04ae769ea9d7eab000c8bc0477716f40ef0ec22" | ||
} |
@@ -520,3 +520,3 @@ import '@lion/core/src/differentKeyEventNamesShimIE.js'; | ||
if (!event.defaultPrevented) { | ||
// await this.transitionHide({ backdropNode: this.backdropNode, conentNode: this.contentNode }); | ||
// await this.transitionHide({ backdropNode: this.backdropNode, contentNode: this.contentNode }); | ||
this._contentWrapperNode.style.display = 'none'; | ||
@@ -523,0 +523,0 @@ this._handleFeatures({ phase: 'hide' }); |
@@ -13,6 +13,4 @@ import { expect, fixture, html, nextFrame, aTimeout } from '@open-wc/testing'; | ||
describe(`OverlayMixin${suffix}`, () => { | ||
let el; | ||
beforeEach(async () => { | ||
el = await fixture(html` | ||
it('should not be opened by default', async () => { | ||
const el = await fixture(html` | ||
<${tag}> | ||
@@ -23,5 +21,2 @@ <div slot="content">content of the overlay</div> | ||
`); | ||
}); | ||
it('should not be opened by default', async () => { | ||
expect(el.opened).to.be.false; | ||
@@ -32,4 +27,14 @@ expect(el._overlayCtrl.isShown).to.be.false; | ||
it('syncs opened to overlayController', async () => { | ||
const el = await fixture(html` | ||
<${tag}> | ||
<div slot="content">content of the overlay</div> | ||
<button slot="invoker">invoker button</button> | ||
</${tag}> | ||
`); | ||
el.opened = true; | ||
expect(el.opened).to.be.true; | ||
await el.updateComplete; | ||
if (el.repositionComplete) { | ||
await el.repositionComplete; | ||
} | ||
await nextFrame(); // overlayCtrl show/hide is async | ||
@@ -40,2 +45,3 @@ expect(el._overlayCtrl.isShown).to.be.true; | ||
expect(el.opened).to.be.false; | ||
await el.updateComplete; | ||
await nextFrame(); // overlayCtrl show/hide is async | ||
@@ -46,2 +52,8 @@ expect(el._overlayCtrl.isShown).to.be.false; | ||
it('syncs OverlayController to opened', async () => { | ||
const el = await fixture(html` | ||
<${tag}> | ||
<div slot="content">content of the overlay</div> | ||
<button slot="invoker">invoker button</button> | ||
</${tag}> | ||
`); | ||
expect(el.opened).to.be.false; | ||
@@ -94,3 +106,3 @@ await el._overlayCtrl.show(); | ||
const spy = sinon.spy(); | ||
el = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} @opened-changed="${spy}"> | ||
@@ -114,3 +126,3 @@ <div slot="content">content of the overlay</div> | ||
const beforeSpy = sinon.spy(); | ||
el = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} @before-closed="${beforeSpy}" .opened="${true}"> | ||
@@ -131,3 +143,3 @@ <div slot="content">content of the overlay</div> | ||
const beforeSpy = sinon.spy(); | ||
el = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} @before-opened="${beforeSpy}"> | ||
@@ -148,3 +160,3 @@ <div slot="content">content of the overlay</div> | ||
} | ||
el = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} @before-opened="${preventer}" @before-closed="${preventer}"> | ||
@@ -176,3 +188,3 @@ <div slot="content">content of the overlay</div> | ||
el = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} opened> | ||
@@ -192,2 +204,11 @@ <div slot="content"> | ||
describe(`OverlayMixin${suffix} nested`, () => { | ||
// For some reason, globalRootNode is not cleared properly on disconnectedCallback from previous overlay test fixtures... | ||
// Not sure why this "bug" happens... | ||
beforeEach(() => { | ||
const globalRootNode = document.querySelector('.global-overlays'); | ||
if (globalRootNode) { | ||
globalRootNode.innerHTML = ''; | ||
} | ||
}); | ||
it('supports nested overlays', async () => { | ||
@@ -230,3 +251,3 @@ const el = await fixture(html` | ||
const mainEl = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} id="main"> | ||
@@ -241,3 +262,3 @@ <div slot="content" id="mainContent"> | ||
if (mainEl._overlayCtrl.placementMode === 'global') { | ||
if (el._overlayCtrl.placementMode === 'global') { | ||
// Specifically checking the output in global root node, because the _contentOverlayNode still references | ||
@@ -256,3 +277,3 @@ // the node that was removed in the teardown but hasn't been garbage collected due to reference to it still existing.. | ||
} else { | ||
const contentNode = mainEl._overlayContentNode.querySelector('#nestedContent'); | ||
const contentNode = el._overlayContentNode.querySelector('#nestedContent'); | ||
expect(contentNode).to.not.be.null; | ||
@@ -274,3 +295,3 @@ expect(contentNode.innerText).to.equal('content of the nested overlay'); | ||
const mainEl = await fixture(html` | ||
const el = await fixture(html` | ||
<${tag} id="main"> | ||
@@ -297,3 +318,3 @@ <div slot="content" id="mainContent"> | ||
mainEl._overlayContentNode.appendChild(nestedEl); | ||
el._overlayContentNode.appendChild(nestedEl); | ||
await aTimeout(); | ||
@@ -300,0 +321,0 @@ expect(setupOverlayCtrlSpy.callCount).to.equal(1); |
241248
4442