Skip to content

Commit

Permalink
fix(VAppBar): fix elevation issue when extended (#8519)
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 authored and johnleider committed Aug 15, 2019
1 parent a4ac722 commit f676454
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vuetify/src/components/VAppBar/VAppBar.ts
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
28 changes: 28 additions & 0 deletions packages/vuetify/src/components/VAppBar/__tests__/VAppBar.spec.ts
Expand Up @@ -248,4 +248,32 @@ 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 f676454

Please sign in to comment.