Skip to content

Commit

Permalink
Add test for 'renders null if an associated AccordionItem is not regi…
Browse files Browse the repository at this point in the history
…stered in accordionStore'
  • Loading branch information
ryami333 committed Feb 21, 2018
1 parent 6424725 commit a88c20a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/AccordionItemTitle/accordion-item-title.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { mount } from 'enzyme';
import { Provider } from 'mobx-react';
import AccordionItemTitle from './accordion-item-title';
import { createAccordionStore } from '../accordionStore/accordionStore';

Expand Down Expand Up @@ -142,4 +143,19 @@ describe('AccordionItemTitle', () => {
accordionStore.items.filter(item => item.expanded === true).length,
).toEqual(1);
});

it('renders null if an associated AccordionItem is not registered in accordionStore', () => {
const className = 'className';
const wrapper = mount(
<Provider accordionStore={accordionStore} uuid="foo">
<AccordionItemTitle className={className}>
<div>Fake body</div>
</AccordionItemTitle>
</Provider>,
);

expect(
wrapper.findWhere(item => item.className === className).length,
).toEqual(0);
});
});

0 comments on commit a88c20a

Please sign in to comment.