import React from 'react';
import { mount, render } from 'enzyme';
import Tabs from '..';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
const { TabPane } = Tabs;
describe('Tabs', () => {
mountTest(() => (
));
rtlTest(() => (
));
describe('editable-card', () => {
let handleEdit;
let wrapper;
beforeEach(() => {
handleEdit = jest.fn();
wrapper = mount(
foo
{undefined}
{null}
{false}
,
);
});
it('add card', () => {
wrapper.find('.ant-tabs-nav-add').first().simulate('click');
expect(handleEdit.mock.calls[0][1]).toBe('add');
});
it('remove card', () => {
wrapper.find('.anticon-close').simulate('click');
expect(handleEdit).toHaveBeenCalledWith('1', 'remove');
});
it('validateElement', () => {
expect(wrapper.find('.ant-tabs-tab').length).toBe(1);
});
});
describe('tabPosition', () => {
it('remove card', () => {
const wrapper = render(
foo
,
);
expect(wrapper).toMatchSnapshot();
});
});
describe('renderTabBar', () => {
it('custom-tab-bar', () => {
const wrapper = render(
custom-tab-bar
}>
foo
,
);
expect(wrapper).toMatchSnapshot();
});
});
it('warning for onNextClick', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
mount( {}} />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Tabs] `onPrevClick` and `onNextClick` has been removed. Please use `onTabScroll` instead.',
);
errorSpy.mockRestore();
});
});