@eturnity/eturnity_reusable_components 9.34.1 → 9.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -244,14 +244,10 @@
|
|
|
244
244
|
default: '400px',
|
|
245
245
|
type: String,
|
|
246
246
|
},
|
|
247
|
-
// Floor for the measured popup width; lower it (e.g. '0') for short
|
|
248
|
-
// tooltip-style content.
|
|
249
247
|
minWidth: {
|
|
250
248
|
default: '230px',
|
|
251
249
|
type: String,
|
|
252
250
|
},
|
|
253
|
-
// Padding of the popup box; tighten (e.g. '6px 10px') for
|
|
254
|
-
// tooltip-style content.
|
|
255
251
|
contentPadding: {
|
|
256
252
|
default: '',
|
|
257
253
|
type: String,
|
|
@@ -579,15 +575,11 @@
|
|
|
579
575
|
clone.style.whiteSpace = 'nowrap' // Prevent text wrapping during measurement
|
|
580
576
|
document.body.appendChild(clone)
|
|
581
577
|
|
|
582
|
-
// Get fresh content width from clone
|
|
583
|
-
// integer, which can under-measure by <1px and wrap an exact-fit
|
|
584
|
-
// line — use the subpixel rect width, ceiled.
|
|
578
|
+
// Get fresh content width from clone
|
|
585
579
|
const contentWidth = Math.ceil(clone.getBoundingClientRect().width)
|
|
586
580
|
document.body.removeChild(clone)
|
|
587
581
|
|
|
588
|
-
// Calculate new width
|
|
589
|
-
// TextOverlay wraps it with 10px horizontal padding each side under
|
|
590
|
-
// border-box sizing — compensate or exact-fit content wraps.
|
|
582
|
+
// Calculate new width
|
|
591
583
|
const TEXT_OVERLAY_HORIZONTAL_PADDING_PX = 20
|
|
592
584
|
const calculatedWidth = Math.min(
|
|
593
585
|
Math.max(
|
|
@@ -665,9 +657,6 @@
|
|
|
665
657
|
}
|
|
666
658
|
})
|
|
667
659
|
|
|
668
|
-
// The text can change while the popup is open (e.g. a save button's
|
|
669
|
-
// tooltip flipping to "saving in progress" mid-hover) — re-measure so
|
|
670
|
-
// the box fits the new content instead of wrapping in the old width.
|
|
671
660
|
watch(
|
|
672
661
|
() => props.text,
|
|
673
662
|
async () => {
|
|
@@ -83,9 +83,7 @@ describe('InfoText Component', () => {
|
|
|
83
83
|
const showPopup = async (w) => {
|
|
84
84
|
w.vm.isMobile = false
|
|
85
85
|
await w.vm.$nextTick()
|
|
86
|
-
// the hover listener sits on the component root
|
|
87
86
|
await w.trigger("mouseenter")
|
|
88
|
-
// updatePosition awaits two ticks before measuring
|
|
89
87
|
await new Promise((resolve) => setTimeout(resolve))
|
|
90
88
|
await w.vm.$nextTick()
|
|
91
89
|
}
|
|
@@ -96,7 +94,6 @@ describe('InfoText Component', () => {
|
|
|
96
94
|
global: { stubs: { teleport: true } },
|
|
97
95
|
})
|
|
98
96
|
await showPopup(roomy)
|
|
99
|
-
// jsdom measures content at 0px, so the floor is what remains
|
|
100
97
|
expect(roomy.vm.infoBoxWidth).toBe(230)
|
|
101
98
|
})
|
|
102
99
|
|
|
@@ -117,7 +114,6 @@ describe('InfoText Component', () => {
|
|
|
117
114
|
global: { stubs: { teleport: true } },
|
|
118
115
|
})
|
|
119
116
|
await showPopup(small)
|
|
120
|
-
// jsdom content measures 0px; only the padding compensation remains
|
|
121
117
|
expect(small.vm.infoBoxWidth).toBe(20)
|
|
122
118
|
})
|
|
123
119
|
})
|
|
@@ -126,8 +122,6 @@ describe('InfoText Component', () => {
|
|
|
126
122
|
let rectSpy
|
|
127
123
|
|
|
128
124
|
beforeEach(() => {
|
|
129
|
-
// jsdom measures everything at 0; size rects from text length so the
|
|
130
|
-
// popup width tracks the measured clone's content.
|
|
131
125
|
rectSpy = jest
|
|
132
126
|
.spyOn(Element.prototype, 'getBoundingClientRect')
|
|
133
127
|
.mockImplementation(function () {
|