Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 994dbde

Browse files
committed
Notify item component about resizing
1 parent 3a2dfbc commit 994dbde

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/listscroller.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export default {
177177
this.heights.set(idx, newHeight)
178178
changed = true
179179
}
180+
if (el.__vue__.onResize) el.__vue__.onResize()
180181
}
181182
})
182183

tests/listscroller.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ describe('ListScroller component', () => {
370370
await wrapper.vm.$nextTick()
371371
expect(wrapper.element).toMatchSnapshot()
372372
})
373+
374+
it('calls onResize method after item resize', async () => {
375+
const item = wrapper.findAllComponents(Item).at(0).vm
376+
item.onResize = jest.fn()
377+
updateSizes(12)
378+
expect(item.onResize).toBeCalledTimes(1)
379+
})
373380
})
374381

375382
describe('with smaller real item height', () => {

0 commit comments

Comments
 (0)