Created
February 11, 2021 19:09
-
-
Save matheusml/9a4c64bcdb20c3b1cfcf51aeda5c9f77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('setOpenIndex sets the open index state properly', () => { | |
const wrapper = mount(<Accordion items={[]} />) | |
expect(wrapper.state('openIndex')).toBe(0) | |
wrapper.instance().setOpenIndex(1) | |
expect(wrapper.state('openIndex')).toBe(1) | |
}) | |
test('Accordion renders AccordionContents with the item contents', () => { | |
const hats = {title: 'Favorite Hats', contents: 'Fedoras are classy'} | |
const footware = { | |
title: 'Favorite Footware', | |
contents: 'Flipflops are the best', | |
} | |
const wrapper = mount(<Accordion items={[hats, footware]} />) | |
expect(wrapper.find('AccordionContents').props().children).toBe(hats.contents) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment