Skip to content
Prev Previous commit
Next Next commit
Test that non tab elements are not cloned
  • Loading branch information
patrick91 committed Aug 10, 2016
commit f55902034b5e43c94a370f4ed34edb639a448dcf
21 changes: 21 additions & 0 deletions src/components/__tests__/Tabs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,27 @@ describe('react-tabs', () => {
expect(wrapper.childAt(2).text()).toBe('Hello Bar');
expect(wrapper.childAt(3).text()).toBe('Hello Baz');
});

it('should not clone non tabs element', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to figure out how to test this 👍
You can just add /* eslint-disable react/no-multi-comp */ at the top of the test to disable the lint.

class Demo extends React.Component {
render() {
const plus = <div ref="yolo">+</div>;

return (<Tabs>
<TabList>
<Tab>Foo</Tab>
{plus}
</TabList>

<TabPanel>Hello Baz</TabPanel>
</Tabs>);
}
}

const wrapper = mount(<Demo />);

expect(wrapper.ref('yolo').text()).toBe('+');
});
});

describe('validation', () => {
Expand Down