Skip to content

Commit

Permalink
fix(v-tabs): remove arbitrary delay on init
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Oct 22, 2018
1 parent 2b2e06d commit 6810169
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/VTabs/VTabs.js
Expand Up @@ -116,7 +116,7 @@ export default BaseItemGroup.extend({
deprecate('@input', '@change', this)
}

setTimeout(this.onResize, 33)
this.updateTabsView()
},
/**
* When v-navigation-drawer changes the
Expand Down
11 changes: 4 additions & 7 deletions test/unit/components/VTabs/VTabs.spec.js
Expand Up @@ -382,7 +382,7 @@ test('VTabs', ({ mount }) => {

it('should set dimensions when onResize is called', async () => {
const setWidths = jest.fn()
const wrapper = mount(VTabs, {
mount(VTabs, {
propsData: {
value: 'foo'
},
Expand All @@ -396,22 +396,19 @@ test('VTabs', ({ mount }) => {
},
methods: { setWidths }
})

expect(setWidths).not.toBeCalled()

await ssrBootable()

expect(setWidths).toHaveBeenCalledTimes(1)

await new Promise(resolve => setTimeout(resolve, 33))

expect(setWidths).toHaveBeenCalledTimes(2)

await resizeWindow(800)

expect(setWidths).toHaveBeenCalledTimes(3)
expect(setWidths).toHaveBeenCalledTimes(2)

await resizeWindow(1800)

expect(setWidths).toHaveBeenCalledTimes(4)
expect(setWidths).toHaveBeenCalledTimes(3)
})
})

0 comments on commit 6810169

Please sign in to comment.