Skip to content

Commit e38cb26

Browse files
committed
test(hooks): should remove the listener
1 parent 5717194 commit e38cb26

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/__tests__/useWindowSize.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,13 @@ describe('useWindowSize', () => {
5353
expect(vm.height).toBe(667);
5454
expect(vm.heightPixel).toBe('667px');
5555
});
56+
57+
it('should remove the listener', () => {
58+
const { vm } = renderHook<InjectWindowSize>(useWindowSize);
59+
triggerResize(SizeType.width, 750);
60+
vm.$destroy();
61+
triggerResize(SizeType.width, 375);
62+
expect(vm.width).toBe(750);
63+
expect(vm.widthPixel).toBe('750px');
64+
});
5665
});

0 commit comments

Comments
 (0)