From e37c93881bedfd3e07a3c91817a8110f8a0a9ba4 Mon Sep 17 00:00:00 2001 From: Borna Cafuk Date: Fri, 9 Sep 2022 16:34:02 +0200 Subject: [PATCH] Run Prettier --- components/avatar/element.js | 50 +++++++------- components/avatar/spec.js | 32 ++++++--- components/avatar/style.js | 4 +- components/badge/element.js | 8 +-- components/badge/spec.js | 15 +++-- components/badge/style.js | 6 +- components/block/element.js | 31 +++++---- components/block/spec.js | 7 +- components/block/style.js | 48 ++++++------- components/dropdown/element.js | 120 ++++++++++++++++++++++----------- components/dropdown/spec.js | 49 +++++++------- components/dropdown/style.js | 6 +- dev/ngl-block.html | 45 +++++++++++-- rollup.config.js | 2 +- web-test-runner.config.js | 3 +- 15 files changed, 260 insertions(+), 166 deletions(-) diff --git a/components/avatar/element.js b/components/avatar/element.js index e291f37..083cc69 100644 --- a/components/avatar/element.js +++ b/components/avatar/element.js @@ -1,23 +1,23 @@ -import { LitElement, html } from 'lit'; -import { colorFromString } from './lib/color_from_string.js'; +import {LitElement, html} from 'lit'; +import {colorFromString} from './lib/color_from_string.js'; import style from './style.js'; export default class Avatar extends LitElement { static styles = [style]; static properties = { - name: { type: String }, - picture: { type: String }, - icon: { type: String }, - label: { type: String }, - rounded: { type: Boolean }, - layout: { type: String, reflect: true }, + name: {type: String}, + picture: {type: String}, + icon: {type: String}, + label: {type: String}, + rounded: {type: Boolean}, + layout: {type: String, reflect: true}, }; constructor() { super(); - this.icon = "user"; - this.layout = "md"; + this.icon = 'user'; + this.layout = 'md'; } get bgColor() { @@ -25,47 +25,45 @@ export default class Avatar extends LitElement { } get initials() { - return this.name.split(/\s+/).map(part => part[0]).slice(0, 2).join(''); + return this.name + .split(/\s+/) + .map((part) => part[0]) + .slice(0, 2) + .join(''); } renderPicture() { - return html` - - `; + return html` `; } renderPlaceholder() { - return html` - - `; + return html` `; } renderInitials() { return html` - ${this.initials} + ${this.initials} `; } renderLabel() { - return html` - ${this.label} - `; + return html` ${this.label} `; } renderContent() { if (this.picture) { return this.renderPicture(); - } if (this.name) { + } + if (this.name) { return this.renderInitials(); } return this.renderPlaceholder(); } render() { - return html` - ${this.renderContent()} - ${this.label && this.renderLabel()} - `; + return html` ${this.renderContent()} ${this.label && this.renderLabel()} `; } } diff --git a/components/avatar/spec.js b/components/avatar/spec.js index 16a584c..dc83aae 100644 --- a/components/avatar/spec.js +++ b/components/avatar/spec.js @@ -6,24 +6,40 @@ describe('bu-avatar', () => { it('renders with placeholder', async () => { const element = await fixture(html``); - assert.shadowDom.equal(element, ` + assert.shadowDom.equal( + element, + ` - `); + ` + ); }); it('renders with initials and background color', async () => { - const element = await fixture(html``); + const element = await fixture( + html`` + ); - assert.shadowDom.equal(element, ` + assert.shadowDom.equal( + element, + ` JD - `); + ` + ); }); it('renders with picture', async () => { - const element = await fixture(html``); + const element = await fixture( + html`` + ); - assert.shadowDom.equal(element, ` + assert.shadowDom.equal( + element, + ` - `); + ` + ); }); }); diff --git a/components/avatar/style.js b/components/avatar/style.js index 2aaf46c..8b19d00 100644 --- a/components/avatar/style.js +++ b/components/avatar/style.js @@ -56,13 +56,13 @@ export default css` border-radius: 50%; } - :host([layout=md]) { + :host([layout='md']) { width: var(--avatar-size, var(--md)); height: var(--avatar-size, var(--md)); font-size: calc(var(--avatar-size, var(--md)) * 0.4); } - :host([layout=lg]) { + :host([layout='lg']) { width: var(--avatar-size, var(--lg)); height: var(--avatar-size, var(--lg)); font-size: calc(var(--avatar-size, var(--lg)) * 0.4); diff --git a/components/badge/element.js b/components/badge/element.js index c81c027..c2abad1 100644 --- a/components/badge/element.js +++ b/components/badge/element.js @@ -5,14 +5,14 @@ export default class Badge extends LitElement { static styles = [style]; static properties = { - count: { type: Number, reflect: true }, - theme: { type: String, reflect: true }, - showZero: { type: Boolean }, + count: {type: Number, reflect: true}, + theme: {type: String, reflect: true}, + showZero: {type: Boolean}, }; constructor() { super(); - this.theme = "secondary"; + this.theme = 'secondary'; } render() { diff --git a/components/badge/spec.js b/components/badge/spec.js index 82d23a1..0cf3a1b 100644 --- a/components/badge/spec.js +++ b/components/badge/spec.js @@ -11,22 +11,27 @@ describe('bu-badge', () => { it('default render', async () => { const element = await fixture(html``); - assert.dom.equal(element, ` + assert.dom.equal( + element, + ` - `); + ` + ); }); it('hidden if count is 0', async () => { const element = await fixture(html``); - assert.shadowDom.equal(element, ""); + assert.shadowDom.equal(element, ''); assert.equal(getComputedStyle(element).display, 'none'); }); it('visible if count is 0 and showZero set to true', async () => { - const element = await fixture(html``); + const element = await fixture( + html`` + ); - assert.shadowDom.equal(element, "0"); + assert.shadowDom.equal(element, '0'); assert.equal(getComputedStyle(element).display, 'inline-flex'); }); }); diff --git a/components/badge/style.js b/components/badge/style.js index 9c9a6b0..c65eca5 100644 --- a/components/badge/style.js +++ b/components/badge/style.js @@ -20,11 +20,11 @@ export default css` border-radius: 10px; } - :host([theme=primary]) { + :host([theme='primary']) { background-color: var(--primary, rgb(13, 110, 253)); } - :host([theme=secondary]) { + :host([theme='secondary']) { background-color: var(--secondary, rgb(50, 157, 125)); } @@ -36,4 +36,4 @@ export default css` :host([showZero][count='0']) { display: inline-flex; } -` +`; diff --git a/components/block/element.js b/components/block/element.js index 08ef972..545c3ef 100644 --- a/components/block/element.js +++ b/components/block/element.js @@ -9,10 +9,10 @@ export default class Block extends LitElement { static styles = [style]; static properties = { - blockId: { type: Number}, + blockId: {type: Number}, }; - renderMenu(){ + renderMenu() { return html`