chore: run prettier

This commit is contained in:
Thijs Louisse 2020-05-18 12:47:03 +02:00
parent e19a0f483c
commit 4719a1e6cd
5 changed files with 26 additions and 99 deletions

View file

@ -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);

View file

@ -18,16 +18,12 @@ import { overlays } from '../src/overlays.js';
const withGlobalTestConfig = () => ({
placementMode: 'global',
contentNode: fixtureSync(html`
<div>my content</div>
`),
contentNode: fixtureSync(html` <div>my content</div> `),
});
const withLocalTestConfig = () => ({
placementMode: 'local',
contentNode: fixtureSync(html`
<div>my content</div>
`),
contentNode: fixtureSync(html` <div>my content</div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;">Invoker</div>
`),
@ -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`
<button>Invoker</button>
`),
invokerNode: await fixture(html` <button>Invoker</button> `),
});
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`
<button>click me</button>
`);
const elOutside = await fixture(html` <button>click me</button> `);
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`
<div><input /></div>
`);
const contentNode = await fixture(html` <div><input /></div> `);
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`
<input />
`);
const elOutside = await fixture(html` <input /> `);
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`
<div role="button">Invoker</div>
`);
const invokerNode = await fixture(html` <div role="button">Invoker</div> `);
const contentNode = await fixture('<div>Content</div>');
const ctrl = new OverlayController({
...withLocalTestConfig(),
@ -1003,11 +984,7 @@ describe('OverlayController', () => {
it('reinitializes content', async () => {
const ctrl = new OverlayController({
...withLocalTestConfig(),
contentNode: await fixture(
html`
<div>content1</div>
`,
),
contentNode: await fixture(html` <div>content1</div> `),
});
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`
<div>content2</div>
`,
),
contentNode: await fixture(html` <div>content2</div> `),
});
expect(ctrl.contentNode.textContent).to.include('content2');
});
it('respects the initial config provided to new OverlayController(initialConfig)', async () => {
const contentNode = fixtureSync(html`
<div>my content</div>
`);
const contentNode = fixtureSync(html` <div>my content</div> `);
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`
<div>my content</div>
`);
const contentNode = fixtureSync(html` <div>my content</div> `);
const ctrl = new OverlayController({
// This is the shared config

View file

@ -5,11 +5,7 @@ import { normalizeTransformStyle } from './utils-tests/local-positioning-helpers
const withLocalTestConfig = () => ({
placementMode: 'local',
contentNode: fixtureSync(
html`
<div>my content</div>
`,
),
contentNode: fixtureSync(html` <div>my content</div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;">Invoker</div>
`),
@ -58,11 +54,7 @@ describe('Local Positioning', () => {
it('uses top as the default placement', async () => {
const ctrl = new OverlayController({
...withLocalTestConfig(),
contentNode: fixtureSync(
html`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}></div>
`),
@ -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`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}></div>
`),
@ -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`
<div style="width: 80px; height: 20px;">invoker</div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;">invoker</div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => 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`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}></div>
`),
@ -168,11 +148,7 @@ describe('Local Positioning', () => {
it('positions the Popper element correctly on show', async () => {
const ctrl = new OverlayController({
...withLocalTestConfig(),
contentNode: fixtureSync(
html`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}></div>
`),
@ -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`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}></div>
`),
@ -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`
<div style="width: 80px; height: 20px;"></div>
`,
),
contentNode: fixtureSync(html` <div style="width: 80px; height: 20px;"></div> `),
invokerNode: fixtureSync(html`
<div role="button" style="width: 100px; height: 20px;" @click=${() => ctrl.show()}>
Invoker

View file

@ -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() {

View file

@ -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`
<lion-option .choiceValue=${30}>Item 3</lion-option>
`);
const validChild = await fixture(html` <lion-option .choiceValue=${30}>Item 3</lion-option> `);
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`
<lion-option .modelValue=${'Lara'}></lion-option>
`);
const invalidChild = await fixture(html` <lion-option .modelValue=${'Lara'}></lion-option> `);
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.. `;
}
},
);