summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil Musin <kamilm@google.com>2023-08-24 14:20:57 +0200
committerKamil Musin <kamilm@google.com>2023-08-24 14:39:50 +0200
commit3869c208b36fd973ebfe18c9164a6d73dc645be2 (patch)
tree3ca583968a7e5ee6791f5d2608c30a66497092b9
parent47d9d71ccb4a6e8905e22908a88fe718ba246522 (diff)
Allow gr-tooltip to render multiline tooltips.
Google-Bug-Id: b/184241013 Release-Notes: skip Change-Id: Ib1a05ce8d9bf8613f583c254bd2d7791708ec1f1
-rw-r--r--polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip.ts5
-rw-r--r--polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts2
2 files changed, 5 insertions, 2 deletions
diff --git a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip.ts b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip.ts
index 681378dda4..1cda32b651 100644
--- a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip.ts
+++ b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip.ts
@@ -70,6 +70,9 @@ export class GrTooltip extends LitElement {
var(--tooltip-background-color);
top: calc(-1 * var(--gr-tooltip-arrow-size));
}
+ .text {
+ white-space: pre;
+ }
`,
];
}
@@ -82,7 +85,7 @@ export class GrTooltip extends LitElement {
class="arrowPositionBelow arrow"
style=${styleMap({marginLeft: this.arrowCenterOffset})}
></i>
- ${this.text}
+ <div class="text">${this.text}</div>
<i
class="arrowPositionAbove arrow"
style=${styleMap({marginLeft: this.arrowCenterOffset})}
diff --git a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
index 63ed1ff48c..bc0cfba324 100644
--- a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
@@ -26,7 +26,7 @@ suite('gr-tooltip tests', () => {
/* HTML */ `
<div class="tooltip">
<i class="arrow arrowPositionBelow" style="margin-left:0;"> </i>
- tooltipText
+ <div class="text">tooltipText</div>
<i class="arrow arrowPositionAbove" style="margin-left:0;"> </i>
</div>
`