Skip to content

Commit

Permalink
fix(VAppBar): fix elevation issue when extended
Browse files Browse the repository at this point in the history
When using **hide-on-scroll** in combination with **extended**, **elevate-on-scroll** would not work
as expected.

fixes #8516
  • Loading branch information
morficus committed Aug 14, 2019
1 parent b03e8f6 commit 7736db8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vuetify/src/components/VAppBar/VAppBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export default baseMixins.extend({
return this.bottom ? scrollOffScreen : -scrollOffScreen
},
hideShadow (): boolean {
if (this.elevateOnScroll && this.isExtended) {
return this.currentScroll < this.computedScrollThreshold
}

if (this.elevateOnScroll) {
return this.currentScroll === 0 ||
this.computedTransform < 0
Expand Down
29 changes: 29 additions & 0 deletions packages/vuetify/src/components/VAppBar/__tests__/VAppBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,33 @@ describe('AppBar.ts', () => {
expect(wrapper.vm.computedTransform).toBe(0)
expect(wrapper.vm.hideShadow).toBe(false)
})

it('should show shadow when hide-on-scroll and elevate-on-scroll and extended are all true', async () => {
const wrapper = mountFunction({
propsData: {
hideOnScroll: true,
elevateOnScroll: true,
extended: true
},
})

expect(wrapper.vm.computedTransform).toBe(0)
expect(wrapper.vm.hideShadow).toBe(true)

await scrollWindow(1000)

expect(wrapper.vm.computedTransform).toBe(-64)
expect(wrapper.vm.hideShadow).toBe(false)

await scrollWindow(600)

expect(wrapper.vm.computedTransform).toBe(0)
expect(wrapper.vm.hideShadow).toBe(false)

await scrollWindow(0)

expect(wrapper.vm.computedTransform).toBe(0)
expect(wrapper.vm.hideShadow).toBe(true)

})
})

0 comments on commit 7736db8

Please sign in to comment.