redux-devtools/packages/devui/tests/Tabs.test.js
Nathan Bierema cd4f022671
chore(devui): upgrade storybook (#626)
* stash

* stash

* stash

* fix

* stash

* fix css

* stash

* stash

* stash

* Fix tests
2020-09-02 13:30:47 -04:00

35 lines
1.0 KiB
JavaScript

import React from 'react';
import { render, mount } from 'enzyme';
import { renderToJson } from 'enzyme-to-json';
import { Tabs } from '../src';
import { tabs, simple10Tabs } from '../src/Tabs/data';
describe('Tabs', function () {
it('renders correctly', () => {
const wrapper = render(<Tabs tabs={tabs} onClick={() => {}} />);
expect(renderToJson(wrapper)).toMatchSnapshot();
});
it('renders with props', () => {
const wrapper = render(
<Tabs tabs={tabs} onClick={() => {}} selected="Tab2" />
);
expect(renderToJson(wrapper)).toMatchSnapshot();
});
it('renders tabs without inner components', () => {
const wrapper = render(
<Tabs tabs={simple10Tabs} onClick={() => {}} selected="5" />
);
expect(renderToJson(wrapper)).toMatchSnapshot();
});
it('should select tab', () => {
const onClick = jest.fn();
const wrapper = mount(<Tabs tabs={tabs} onClick={onClick} />);
wrapper.find('button').first().simulate('click');
expect(onClick).toBeCalled();
});
});