diff --git a/packages/overlays/src/OverlayController.js b/packages/overlays/src/OverlayController.js index 8238b6125..200abbe83 100644 --- a/packages/overlays/src/OverlayController.js +++ b/packages/overlays/src/OverlayController.js @@ -132,9 +132,7 @@ export class OverlayController { }; this.manager.add(this); - this._contentId = `overlay-content--${Math.random() - .toString(36) - .substr(2, 10)}`; + this._contentId = `overlay-content--${Math.random().toString(36).substr(2, 10)}`; if (this._defaultConfig.contentNode) { this.__isContentNodeProjected = Boolean(this._defaultConfig.contentNode.assignedSlot); diff --git a/packages/overlays/test/OverlayController.test.js b/packages/overlays/test/OverlayController.test.js index 7f5c01144..b1615f34e 100644 --- a/packages/overlays/test/OverlayController.test.js +++ b/packages/overlays/test/OverlayController.test.js @@ -18,16 +18,12 @@ import { overlays } from '../src/overlays.js'; const withGlobalTestConfig = () => ({ placementMode: 'global', - contentNode: fixtureSync(html` -
my content
- `), + contentNode: fixtureSync(html`
my content
`), }); const withLocalTestConfig = () => ({ placementMode: 'local', - contentNode: fixtureSync(html` -
my content
- `), + contentNode: fixtureSync(html`
my content
`), invokerNode: fixtureSync(html`
Invoker
`), @@ -138,9 +134,7 @@ describe('OverlayController', () => { it.skip('creates local target next to sibling for placement mode "local"', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - invokerNode: await fixture(html` - - `), + invokerNode: await fixture(html` `), }); expect(ctrl._renderTarget).to.be.undefined; expect(ctrl.content).to.equal(ctrl.invokerNode.nextElementSibling); @@ -272,9 +266,7 @@ describe('OverlayController', () => { }); await ctrl.show(); - const elOutside = await fixture(html` - - `); + const elOutside = await fixture(html` `); const input1 = ctrl.contentNode.querySelectorAll('input')[0]; const input2 = ctrl.contentNode.querySelectorAll('input')[1]; @@ -289,9 +281,7 @@ describe('OverlayController', () => { }); it('allows to move the focus outside of the overlay if trapsKeyboardFocus is disabled', async () => { - const contentNode = await fixture(html` -
- `); + const contentNode = await fixture(html`
`); const ctrl = new OverlayController({ ...withGlobalTestConfig(), @@ -299,14 +289,10 @@ describe('OverlayController', () => { trapsKeyboardFocus: true, }); // add element to dom to allow focus - await fixture(html` - ${ctrl.content} - `); + await fixture(html` ${ctrl.content} `); await ctrl.show(); - const elOutside = await fixture(html` - - `); + const elOutside = await fixture(html` `); const input = ctrl.contentNode.querySelector('input'); input.focus(); @@ -462,10 +448,7 @@ describe('OverlayController', () => { await ctrl.show(); // Don't hide on inside shadowDom click - ctrl.contentNode - .querySelector(tagString) - .shadowRoot.querySelector('button') - .click(); + ctrl.contentNode.querySelector(tagString).shadowRoot.querySelector('button').click(); await aTimeout(); expect(ctrl.isShown).to.be.true; @@ -514,9 +497,7 @@ describe('OverlayController', () => { }); it('works with 3rd party code using "event.stopPropagation()" on capture phase', async () => { - const invokerNode = await fixture(html` -
Invoker
- `); + const invokerNode = await fixture(html`
Invoker
`); const contentNode = await fixture('
Content
'); const ctrl = new OverlayController({ ...withLocalTestConfig(), @@ -1003,11 +984,7 @@ describe('OverlayController', () => { it('reinitializes content', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: await fixture( - html` -
content1
- `, - ), + contentNode: await fixture(html`
content1
`), }); await ctrl.show(); // Popper adds inline styles expect(ctrl.content.style.transform).not.to.be.undefined; @@ -1015,19 +992,13 @@ describe('OverlayController', () => { ctrl.updateConfig({ placementMode: 'local', - contentNode: await fixture( - html` -
content2
- `, - ), + contentNode: await fixture(html`
content2
`), }); expect(ctrl.contentNode.textContent).to.include('content2'); }); it('respects the initial config provided to new OverlayController(initialConfig)', async () => { - const contentNode = fixtureSync(html` -
my content
- `); + const contentNode = fixtureSync(html`
my content
`); const ctrl = new OverlayController({ // This is the shared config @@ -1047,9 +1018,7 @@ describe('OverlayController', () => { // Currently not working, enable again when we fix updateConfig it.skip('allows for updating viewport config placement only, while keeping the content shown', async () => { - const contentNode = fixtureSync(html` -
my content
- `); + const contentNode = fixtureSync(html`
my content
`); const ctrl = new OverlayController({ // This is the shared config diff --git a/packages/overlays/test/local-positioning.test.js b/packages/overlays/test/local-positioning.test.js index 6d008dc7e..0b36c998c 100644 --- a/packages/overlays/test/local-positioning.test.js +++ b/packages/overlays/test/local-positioning.test.js @@ -5,11 +5,7 @@ import { normalizeTransformStyle } from './utils-tests/local-positioning-helpers const withLocalTestConfig = () => ({ placementMode: 'local', - contentNode: fixtureSync( - html` -
my content
- `, - ), + contentNode: fixtureSync(html`
my content
`), invokerNode: fixtureSync(html`
Invoker
`), @@ -58,11 +54,7 @@ describe('Local Positioning', () => { it('uses top as the default placement', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}>
`), @@ -79,11 +71,7 @@ describe('Local Positioning', () => { it('positions to preferred place if placement is set and space is available', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}>
`), @@ -104,11 +92,7 @@ describe('Local Positioning', () => { it('positions to different place if placement is set and no space is available', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
invoker
- `, - ), + contentNode: fixtureSync(html`
invoker
`), invokerNode: fixtureSync(html`
ctrl.show()}> content @@ -131,11 +115,7 @@ describe('Local Positioning', () => { it('allows the user to override default Popper modifiers', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}>
`), @@ -168,11 +148,7 @@ describe('Local Positioning', () => { it('positions the Popper element correctly on show', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}>
`), @@ -203,11 +179,7 @@ describe('Local Positioning', () => { it.skip('updates placement properly even during hidden state', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}>
`), @@ -256,11 +228,7 @@ describe('Local Positioning', () => { it.skip('updates positioning correctly during shown state when config gets updated', async () => { const ctrl = new OverlayController({ ...withLocalTestConfig(), - contentNode: fixtureSync( - html` -
- `, - ), + contentNode: fixtureSync(html`
`), invokerNode: fixtureSync(html`
ctrl.show()}> Invoker diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index 73b59a5bd..d643fe5d3 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -8,9 +8,7 @@ import './differentKeyNamesShimIE.js'; import { LionSelectInvoker } from './LionSelectInvoker.js'; function uuid() { - return Math.random() - .toString(36) - .substr(2, 10); + return Math.random().toString(36).substr(2, 10); } function detectInteractionMode() { diff --git a/packages/select-rich/test/lion-select-rich.test.js b/packages/select-rich/test/lion-select-rich.test.js index d0f58c06c..7fd6e817f 100644 --- a/packages/select-rich/test/lion-select-rich.test.js +++ b/packages/select-rich/test/lion-select-rich.test.js @@ -37,9 +37,7 @@ describe('lion-select-rich', () => { expect(el.formElements[0].name).to.equal('foo'); expect(el.formElements[1].name).to.equal('foo'); - const validChild = await fixture(html` - Item 3 - `); + const validChild = await fixture(html` Item 3 `); el.appendChild(validChild); expect(el.formElements[2].name).to.equal('foo'); @@ -56,9 +54,7 @@ describe('lion-select-rich', () => { `); await nextFrame(); - const invalidChild = await fixture(html` - - `); + const invalidChild = await fixture(html` `); expect(() => { el.addFormElement(invalidChild); @@ -805,9 +801,7 @@ describe('lion-select-rich', () => { const invokerTagName = defineCE( class extends LionSelectInvoker { _noSelectionTemplate() { - return html` - Please select an option.. - `; + return html` Please select an option.. `; } }, );