Skip to content

Commit

Permalink
Add Tabs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Mar 1, 2017
1 parent 7174337 commit 3d3abe8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions components/tabs/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import { mount } from 'enzyme';
import Tabs from '..';

const { TabPane } = Tabs;

describe('Tabs', () => {
describe('editable-card', () => {
let handleEdit;
let wrapper;

beforeEach(() => {
handleEdit = jest.fn();
wrapper = mount(
<Tabs type="editable-card" onEdit={handleEdit}>
<TabPane tab="foo" key="1">foo</TabPane>
</Tabs>
);
});

it('add card', () => {
wrapper.find('.ant-tabs-new-tab').simulate('click');
expect(handleEdit.mock.calls[0][1]).toBe('add');
});

it('remove card', () => {
wrapper.find('.anticon-close').simulate('click');
expect(handleEdit).toBeCalledWith('1', 'remove');
});
});
});

0 comments on commit 3d3abe8

Please sign in to comment.