Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VFab/VFab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const VFab = genericComponent()({
const el = shallowRef<HTMLElement>()
useResizeObserver(el, entries => {
if (!entries.length) return
height.value = entries[0].contentRect.height
height.value = entries[0].target.clientHeight
})

const hasPosition = toRef(() => props.app || props.absolute)
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VFooter/VFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const VFooter = genericComponent()({
const el = shallowRef<HTMLElement>()
useResizeObserver(el, entries => {
if (!entries.length) return
autoHeight.value = entries[0].contentRect.height
autoHeight.value = entries[0].target.clientHeight
})
const height = computed(() => props.height === 'auto' ? autoHeight.value : parseInt(props.height, 10))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Components
import { VFooter } from '..'
import { VLayout } from '@/components/VLayout'
import { VMain } from '@/components/VMain'

// Utilities
import { commands, render, screen } from '@test'

describe('VFooter', () => {
it('should reserve layout space equal to its rendered height', async () => {
render(() => (
<VLayout>
<VMain>Content</VMain>
<VFooter app>Footer</VFooter>
</VLayout>
))

const footer = screen.getByCSS('.v-footer')
const main = screen.getByCSS('.v-main')

await commands.waitStable('.v-footer')

// Default $footer-padding is 8px 16px, so the content box is 16px shorter
// than the box the footer actually occupies. The layout must reserve the
// latter or the last 16px of VMain content renders underneath the footer.
const rendered = footer.getBoundingClientRect().height
const reserved = parseFloat(getComputedStyle(main).paddingBottom)

expect(rendered).toBeGreaterThan(0)
expect(reserved).toBe(rendered)
})

it('should reserve layout space including custom vertical padding', async () => {
render(() => (
<VLayout>
<VMain>Content</VMain>
<VFooter app style="padding-top: 40px; padding-bottom: 40px">Footer</VFooter>
</VLayout>
))

const footer = screen.getByCSS('.v-footer')
const main = screen.getByCSS('.v-main')

await commands.waitStable('.v-footer')

const rendered = footer.getBoundingClientRect().height
const reserved = parseFloat(getComputedStyle(main).paddingBottom)

expect(rendered).toBeGreaterThan(80)
expect(reserved).toBe(rendered)
})
})
Loading