Skip to content

Commit d70bb8e

Browse files
authored
refactor: update dashboard styles, fix unit tests to use src version (#9563)
1 parent 021764c commit d70bb8e

11 files changed

Lines changed: 60 additions & 27 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license
3+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
4+
*
5+
* This program is available under Vaadin Commercial License and Service Terms.
6+
*
7+
*
8+
* See https://vaadin.com/commercial-license-and-service-terms for the full
9+
* license.
10+
*/
11+
import type { CSSResult } from 'lit';
12+
13+
export const dashboardButtonStyles: CSSResult;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
4+
*
5+
* This program is available under Vaadin Commercial License and Service Terms.
6+
*
7+
*
8+
* See https://vaadin.com/commercial-license-and-service-terms for the full
9+
* license.
10+
*/
11+
import { css } from 'lit';
12+
import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-core-styles.js';
13+
14+
const dashboardButton = css`
15+
:host {
16+
min-width: 1rem;
17+
}
18+
`;
19+
20+
export const dashboardButtonStyles = [buttonStyles, dashboardButton];

‎packages/dashboard/src/styles/vaadin-dashboard-widget-core-styles.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const widgetStyles = css`
3131
[part~='content'] {
3232
flex: 1;
3333
overflow: hidden;
34+
min-height: 1rem;
3435
}
3536
3637
[part~='resize-button'] {

‎packages/dashboard/src/vaadin-dashboard-button.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
* license.
1010
*/
1111
import { html, LitElement } from 'lit';
12-
import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-core-styles.js';
1312
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
1413
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
1514
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
1615
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
1716
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
1817
import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
1918
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
19+
import { dashboardButtonStyles } from './styles/vaadin-dashboard-button-core-styles.js';
2020

2121
class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement))))) {
2222
static get is() {
2323
return 'vaadin-dashboard-button';
2424
}
2525

2626
static get styles() {
27-
return buttonStyles;
27+
return dashboardButtonStyles;
2828
}
2929

3030
/** @protected */

‎packages/dashboard/test/dashboard-keyboard.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect } from '@vaadin/chai-plugins';
22
import { sendKeys } from '@vaadin/test-runner-commands';
33
import { fixtureSync, isChrome, isFirefox, nextFrame, nextResize } from '@vaadin/testing-helpers';
44
import sinon from 'sinon';
5-
import '../vaadin-dashboard.js';
6-
import type { Dashboard, DashboardItem } from '../vaadin-dashboard.js';
5+
import '../src/vaadin-dashboard.js';
6+
import type { Dashboard, DashboardItem } from '../src/vaadin-dashboard.js';
77
import {
88
describeBidirectional,
99
getDraggable,

‎packages/dashboard/test/dashboard-layout.test.ts‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { expect } from '@vaadin/chai-plugins';
22
import { fixtureSync, nextFrame, nextResize } from '@vaadin/testing-helpers';
3-
import '../vaadin-dashboard-layout.js';
4-
import '../vaadin-dashboard-section.js';
5-
import '@vaadin/vaadin-lumo-styles/spacing.js';
6-
import type { DashboardLayout } from '../vaadin-dashboard-layout.js';
7-
import type { DashboardSection } from '../vaadin-dashboard-section.js';
3+
import '../src/vaadin-dashboard-layout.js';
4+
import '../src/vaadin-dashboard-section.js';
5+
import type { DashboardLayout } from '../src/vaadin-dashboard-layout.js';
6+
import type { DashboardSection } from '../src/vaadin-dashboard-section.js';
87
import {
98
expectLayout,
109
getColumnWidths,
@@ -25,7 +24,7 @@ const [defaultSpacing, defaultMinimumColumnWidth] = (() => {
2524
document.body.appendChild(div);
2625
div.style.width = '1rem';
2726
const minColWidth = div.offsetWidth * 25;
28-
div.style.width = 'var(--lumo-space-m)';
27+
div.style.width = '1rem'; // var(--lumo-space-m)
2928
const spacing = div.offsetWidth;
3029
div.remove();
3130
return [spacing, minColWidth];
@@ -360,9 +359,9 @@ describe('dashboard layout', () => {
360359
await nextResize(dashboard);
361360

362361
const { left: itemLeft } = childElements[0].getBoundingClientRect();
363-
const { left: dashbboardLeft } = dashboard.getBoundingClientRect();
364-
// Expect the dashbaord to have default padding of 1rem
365-
expect(itemLeft - dashbboardLeft).to.eql(defaultSpacing);
362+
const { left: dashboardLeft } = dashboard.getBoundingClientRect();
363+
// Expect the dashboard to have default padding of 1rem
364+
expect(itemLeft - dashboardLeft).to.eql(defaultSpacing);
366365
});
367366

368367
it('should have custom gap between items horizontally', async () => {
@@ -371,9 +370,9 @@ describe('dashboard layout', () => {
371370
await nextResize(dashboard);
372371

373372
const { left: itemLeft } = childElements[0].getBoundingClientRect();
374-
const { left: dashbboardLeft } = dashboard.getBoundingClientRect();
373+
const { left: dashboardLeft } = dashboard.getBoundingClientRect();
375374
// Expect the items to have a gap of 10px
376-
expect(itemLeft - dashbboardLeft).to.eql(customSpacing);
375+
expect(itemLeft - dashboardLeft).to.eql(customSpacing);
377376
});
378377
});
379378

‎packages/dashboard/test/dashboard-section.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@vaadin/chai-plugins';
22
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
3-
import '../vaadin-dashboard-section.js';
4-
import type { DashboardSection } from '../vaadin-dashboard-section.js';
3+
import '../src/vaadin-dashboard-section.js';
4+
import type { DashboardSection } from '../src/vaadin-dashboard-section.js';
55
import {
66
getDraggable,
77
getMoveApplyButton,

‎packages/dashboard/test/dashboard-widget-reordering.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect } from '@vaadin/chai-plugins';
22
import { resetMouse, sendMouse, sendMouseToElement } from '@vaadin/test-runner-commands';
33
import { fixtureSync, isFirefox, nextFrame, nextResize } from '@vaadin/testing-helpers';
44
import sinon from 'sinon';
5-
import '../vaadin-dashboard.js';
6-
import type { Dashboard, DashboardItem, DashboardSectionItem } from '../vaadin-dashboard.js';
5+
import '../src/vaadin-dashboard.js';
6+
import type { Dashboard, DashboardItem, DashboardSectionItem } from '../src/vaadin-dashboard.js';
77
import {
88
createDragEvent,
99
expectLayout,

‎packages/dashboard/test/dashboard-widget-resizing.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { expect } from '@vaadin/chai-plugins';
22
import { fire, fixtureSync, nextFrame, nextResize } from '@vaadin/testing-helpers';
33
import sinon from 'sinon';
4-
import '../vaadin-dashboard.js';
4+
import '../src/vaadin-dashboard.js';
55
import { isSafari } from '@vaadin/component-base/src/browser-utils.js';
6-
import type { Dashboard, DashboardItem } from '../vaadin-dashboard.js';
6+
import type { Dashboard, DashboardItem } from '../src/vaadin-dashboard.js';
77
import {
88
describeBidirectional,
99
expectLayout,

‎packages/dashboard/test/dashboard-widget.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect } from '@vaadin/chai-plugins';
22
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
3-
import '../vaadin-dashboard-widget.js';
4-
import { DashboardSection } from '../vaadin-dashboard-section.js';
5-
import { DashboardWidget } from '../vaadin-dashboard-widget.js';
3+
import '../src/vaadin-dashboard-widget.js';
4+
import { DashboardSection } from '../src/vaadin-dashboard-section.js';
5+
import { DashboardWidget } from '../src/vaadin-dashboard-widget.js';
66
import {
77
getDraggable,
88
getMoveApplyButton,

0 commit comments

Comments
 (0)