Skip to content

Commit

Permalink
fix(tabs): add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
julienbirgand committed May 28, 2020
1 parent 3b9f4b1 commit 8f03c1a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/tabs/src/Tabs.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react';
import { mount } from 'enzyme';
import Tabs from './Tabs';

describe('Tabs', () => {
it('should display tab content when user clicks on tab link', () => {
const wrapper = mount(
<Tabs>
<Tabs.Tab title="Title 1">Content 1</Tabs.Tab>
<Tabs.Tab title="Title 2">Content 2</Tabs.Tab>
</Tabs>
);

expect(wrapper.find('.af-tabs__content').text()).toBe('Content 1');

const secondTabLink = wrapper.find('button').at(1);
secondTabLink.simulate('click');

expect(wrapper.find('.af-tabs__content').text()).toBe('Content 2');
});
});

0 comments on commit 8f03c1a

Please sign in to comment.