Skip to content

Commit

Permalink
fix: set default max-width: 40ch on the tooltip overlay (#4833)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored and vaadin-bot committed Oct 25, 2022
1 parent 24762ee commit d1e16b4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/tooltip/src/vaadin-tooltip-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
registerStyles(
'vaadin-tooltip-overlay',
css`
[part='overlay'] {
max-width: 40ch;
}
:host([position^='top'][top-aligned]) [part='overlay'],
:host([position^='bottom'][top-aligned]) [part='overlay'] {
margin-top: var(--vaadin-tooltip-offset-top, 0);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/tooltip/test/visual/lumo/tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,19 @@ describe('tooltip', () => {
document.documentElement.setAttribute('theme', 'dark');
});

after(() => {
document.documentElement.removeAttribute('theme');
});

it('theme-dark', async () => {
fire(target, 'mouseenter');
await visualDiff(div, 'theme-dark');
});
});

it('max-width', async () => {
element.text = 'This is a tooltip with a long text (more than 40 chars), it should wrap in 2 lines for readability';
fire(target, 'mouseenter');
await visualDiff(div, 'max-width');
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/tooltip/test/visual/material/tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@ describe('tooltip', () => {
document.documentElement.setAttribute('theme', 'dark');
});

after(() => {
document.documentElement.removeAttribute('theme');
});

it('theme-dark', async () => {
fire(target, 'mouseenter');
await visualDiff(div, 'theme-dark');
});
});

it('max-width', async () => {
element.text = 'This is a tooltip with a long text (more than 40 chars), it should wrap in 2 lines for readability';
fire(target, 'mouseenter');
await visualDiff(div, 'max-width');
});
});

0 comments on commit d1e16b4

Please sign in to comment.