Skip to content

Commit

Permalink
refactor!: set white-space: pre-wrap on the tooltip content (#8255)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Dec 2, 2024
1 parent 97e2acb commit fc8e744
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/tooltip/src/vaadin-tooltip-overlay-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const tooltipOverlayStyles = css`
max-width: 40ch;
}
[part='content'] {
white-space: pre-wrap;
}
:host([position^='top'][top-aligned]) [part='overlay'],
:host([position^='bottom'][top-aligned]) [part='overlay'] {
margin-top: var(--vaadin-tooltip-offset-top, 0);
Expand Down
3 changes: 0 additions & 3 deletions packages/tooltip/test/visual/lumo/tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ describe('tooltip', () => {
it('white-space-pre', async () => {
element.text = 'Line 1\n\nLine 2';
fire(target, 'mouseenter');
const overlay = document.querySelector('vaadin-tooltip-overlay');
const content = overlay.shadowRoot.querySelector('[part="content"]');
content.style.whiteSpace = 'pre';
await visualDiff(div, 'white-space-pre');
});
});
3 changes: 0 additions & 3 deletions packages/tooltip/test/visual/material/tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ describe('tooltip', () => {
it('white-space-pre', async () => {
element.text = 'Line 1\n\nLine 2';
fire(target, 'mouseenter');
const overlay = document.querySelector('vaadin-tooltip-overlay');
const content = overlay.shadowRoot.querySelector('[part="content"]');
content.style.whiteSpace = 'pre';
await visualDiff(div, 'white-space-pre');
});
});

0 comments on commit fc8e744

Please sign in to comment.