chore: add exception in test for "keepBodySize" on MacSafari, since body.body.global-overlays-scroll-lock-ios-fix renders scrollbar
This commit is contained in:
parent
5d76318e45
commit
36260d39d1
1 changed files with 20 additions and 14 deletions
|
|
@ -4,6 +4,7 @@ import sinon from 'sinon';
|
||||||
import { overlays, OverlayController } from '@lion/ui/overlays.js';
|
import { overlays, OverlayController } from '@lion/ui/overlays.js';
|
||||||
|
|
||||||
import '@lion/ui/define/lion-dialog.js';
|
import '@lion/ui/define/lion-dialog.js';
|
||||||
|
import { _browserDetection } from '../src/OverlaysManager.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import('../types/OverlayConfig.js').OverlayConfig} OverlayConfig
|
* @typedef {import('../types/OverlayConfig.js').OverlayConfig} OverlayConfig
|
||||||
|
|
@ -77,6 +78,7 @@ export function runOverlayMixinSuite({ tagString, tag, suffix = '' }) {
|
||||||
expect(el.opened).to.be.false;
|
expect(el.opened).to.be.false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: put this tests in OverlayController.test.js instead?
|
||||||
it('does not change the body size when opened', async () => {
|
it('does not change the body size when opened', async () => {
|
||||||
const parentNode = document.createElement('div');
|
const parentNode = document.createElement('div');
|
||||||
parentNode.setAttribute('style', 'height: 10000px; width: 10000px;');
|
parentNode.setAttribute('style', 'height: 10000px; width: 10000px;');
|
||||||
|
|
@ -91,24 +93,28 @@ export function runOverlayMixinSuite({ tagString, tag, suffix = '' }) {
|
||||||
{ parentNode },
|
{ parentNode },
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const { offsetWidth, offsetHeight } = /** @type {HTMLElement} */ (
|
|
||||||
elWithBigParent.offsetParent
|
// For now, we skip this test for MacSafari, since the body.global-overlays-scroll-lock-ios-fix
|
||||||
|
// class results in a scrollbar when preventsScroll is true.
|
||||||
|
// However, fully functioning interacive elements (input fields) in the dialog are more important
|
||||||
|
if (_browserDetection.isMacSafari && elWithBigParent._overlayCtrl.preventsScroll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const elWithBigParentOffsetParent = /** @type {HTMLElement} */ (
|
||||||
|
elWithBigParent?.offsetParent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { offsetWidth, offsetHeight } = elWithBigParentOffsetParent;
|
||||||
|
|
||||||
await elWithBigParent._overlayCtrl.show();
|
await elWithBigParent._overlayCtrl.show();
|
||||||
|
|
||||||
expect(elWithBigParent.opened).to.be.true;
|
expect(elWithBigParent.opened).to.be.true;
|
||||||
expect(/** @type {HTMLElement} */ (elWithBigParent?.offsetParent).offsetWidth).to.equal(
|
expect(elWithBigParentOffsetParent.offsetWidth).to.equal(offsetWidth);
|
||||||
offsetWidth,
|
expect(elWithBigParentOffsetParent.offsetHeight).to.equal(offsetHeight);
|
||||||
);
|
|
||||||
expect(/** @type {HTMLElement} */ (elWithBigParent?.offsetParent).offsetHeight).to.equal(
|
|
||||||
offsetHeight,
|
|
||||||
);
|
|
||||||
await elWithBigParent._overlayCtrl.hide();
|
await elWithBigParent._overlayCtrl.hide();
|
||||||
expect(/** @type {HTMLElement} */ (elWithBigParent?.offsetParent).offsetWidth).to.equal(
|
expect(elWithBigParentOffsetParent.offsetWidth).to.equal(offsetWidth);
|
||||||
offsetWidth,
|
expect(elWithBigParentOffsetParent.offsetHeight).to.equal(offsetHeight);
|
||||||
);
|
|
||||||
expect(/** @type {HTMLElement} */ (elWithBigParent?.offsetParent).offsetHeight).to.equal(
|
|
||||||
offsetHeight,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should respond to initially and dynamically setting the config', async () => {
|
it('should respond to initially and dynamically setting the config', async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue