Skip to content

Commit 9511bc3

Browse files
committed
fix(VTimeline): keep dot border when using numeric dot size
fixes #22499
1 parent c3b3278 commit 9511bc3

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

packages/vuetify/src/components/VTimeline/VTimeline.sass

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
background-color: transparent !important
2222

2323
.v-timeline
24+
--v-timeline-dot-border-size: #{map.get($timeline-dot-border-sizes, 'default')}
25+
2426
display: grid
2527
grid-auto-flow: dense
2628
position: relative
@@ -208,18 +210,17 @@
208210
$size: $timeline-dot-size + (8 * $multiplier)
209211

210212
&--size-#{$name}
213+
--v-timeline-dot-border-size: #{map.get($timeline-dot-border-sizes, $name)}
211214
height: $size
212215
width: $size
213216

214-
.v-timeline-divider__inner-dot
215-
height: calc(100% - #{map.get($timeline-dot-border-sizes, $name)})
216-
width: calc(100% - #{map.get($timeline-dot-border-sizes, $name)})
217-
218217
.v-timeline-divider__inner-dot
219218
align-items: center
220219
border-radius: $timeline-dot-border-radius
221220
display: flex
222221
justify-content: center
222+
height: calc(100% - var(--v-timeline-dot-border-size))
223+
width: calc(100% - var(--v-timeline-dot-border-size))
223224

224225
/** Modifiers **/
225226

packages/vuetify/src/components/VTimeline/__tests__/VTimeline.spec.browser.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,39 @@ describe('VTimeline', () => {
171171
})
172172
})
173173

174+
it('should not fill dot when size is a number and fill-dot is false', async () => {
175+
render(() => (
176+
<VTimeline>
177+
<VTimelineItem size={ 40 } fillDot={ false }>
178+
{{ default: () => 'Content' }}
179+
</VTimelineItem>
180+
</VTimeline>
181+
))
182+
183+
const outerDot = screen.getByCSS('.v-timeline-divider__dot')
184+
const innerDot = screen.getByCSS('.v-timeline-divider__inner-dot')
185+
186+
expect(outerDot.getBoundingClientRect().width).toBe(40)
187+
expect(innerDot.getBoundingClientRect().width).toBe(32)
188+
expect(innerDot.getBoundingClientRect().height).toBe(32)
189+
})
190+
191+
it('should fill dot when size is a number and fill-dot is true', async () => {
192+
render(() => (
193+
<VTimeline>
194+
<VTimelineItem size={ 40 } fillDot>
195+
{{ default: () => 'Content' }}
196+
</VTimelineItem>
197+
</VTimeline>
198+
))
199+
200+
const outerDot = screen.getByCSS('.v-timeline-divider__dot')
201+
const innerDot = screen.getByCSS('.v-timeline-divider__inner-dot')
202+
203+
expect(outerDot.getBoundingClientRect().width).toBe(40)
204+
expect(innerDot.getBoundingClientRect().width).toBe(40)
205+
expect(innerDot.getBoundingClientRect().height).toBe(40)
206+
})
207+
174208
showcase({ stories })
175209
})

0 commit comments

Comments
 (0)