import { mount, later } from '../../../test'; import { Tab } from '..'; import { Tabs } from '../../tabs'; test('should emit click event when tab is clicked', async () => { const onClick = jest.fn(); const wrapper = mount({ render() { return ( 1 2 ); }, }); await later(); const tabs = wrapper.findAll('.van-tab'); await tabs[0].trigger('click'); expect(onClick).toHaveBeenCalledWith(0, 'title1'); }); test('should emit click-tab event when tab is clicked', async () => { const onClickTab = jest.fn(); const wrapper = mount({ render() { return ( 1 2 ); }, }); await later(); const tabs = wrapper.findAll('.van-tab'); await tabs[0].trigger('click'); expect(onClickTab).toHaveBeenCalledWith( expect.objectContaining({ name: 0, title: 'title1', }) ); });