{"size": 1062, "ext": "js", "max_stars_repo_path": "__tests__/tabs.test.js", "max_stars_repo_name": "KaiOrange/asumi-ui", "max_stars_repo_stars_event_min_datetime": "2017-11-27T02:18:35.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-05T07:52:21.000Z", "max_issues_repo_path": "__tests__/tabs.test.js", "max_issues_repo_name": "KaiOrange/asumi-ui", "max_issues_repo_issues_event_min_datetime": "2018-01-12T09:51:39.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-29T02:35:32.000Z", "max_forks_repo_path": "__tests__/tabs.test.js", "max_forks_repo_name": "KaiOrange/asumi-ui", "max_forks_repo_forks_event_min_datetime": "2017-11-27T02:18:41.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-15T00:55:01.000Z"}
{"max_stars_count": 16, "max_issues_count": 12, "max_forks_count": 7, "avg_line_length": 34.2580645161, "max_line_length": 118, "alphanum_fraction": 0.5404896422}
import React from 'react';
import {mount} from 'enzyme';
import {Tabs, TabPanel} from '../src';

describe('Tabs', () => {
    it('create component', () => {
        const component = mount(<Tabs><TabPanel id="1">a</TabPanel></Tabs>);
        expect(component).toMatchSnapshot();
    });
    it('create component[null]', () => {
        const component = mount(<Tabs>{null}</Tabs>);
        expect(component).toMatchSnapshot();
    });
    it('define activeId', () => {
        const component = mount(<Tabs activeId="2"><TabPanel id="1">a</TabPanel><TabPanel id="2">b</TabPanel></Tabs>);
        expect(component).toMatchSnapshot();
    });
    it('define onClick', () => {
        const handleClick = jest.fn();
        const component = mount(
            <Tabs activeId="2"
                  onClick={handleClick}>
                <TabPanel id="1">a</TabPanel>
                <TabPanel id="2">b</TabPanel>
            </Tabs>
        );
        component.find('.el-tabs-nav li').at(0).simulate('click');
        expect(handleClick).toBeCalled();
    });
});
