Commit 38f8caa2 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Fix ShareDialog test

parent be2db7a3
import { Tab } from '@hypothesis/frontend-shared';
import { mount } from 'enzyme'; import { mount } from 'enzyme';
import { checkAccessibility } from '../../../../test-util/accessibility'; import { checkAccessibility } from '../../../../test-util/accessibility';
...@@ -59,14 +60,11 @@ describe('ShareDialog', () => { ...@@ -59,14 +60,11 @@ describe('ShareDialog', () => {
}); });
function selectTab(wrapper, name) { function selectTab(wrapper, name) {
wrapper wrapper.find(`button[aria-controls="${name}-panel"]`).simulate('click');
.find(`Tab[aria-controls="${name}-panel"]`)
.find('button')
.simulate('click');
} }
function getActiveTab(wrapper) { function getActiveTab(wrapper) {
return wrapper.find('Tab').filter({ selected: true }); return wrapper.find(Tab).filter({ selected: true });
} }
function activeTabPanel(wrapper) { function activeTabPanel(wrapper) {
...@@ -79,18 +77,14 @@ describe('ShareDialog', () => { ...@@ -79,18 +77,14 @@ describe('ShareDialog', () => {
assert.isFalse(wrapper.find('TabHeader').exists()); assert.isFalse(wrapper.find('TabHeader').exists());
}); });
[ [{ importTab: false }, { exportTab: false }, {}].forEach(props => {
[{ shareTab: false }],
[{ importTab: false }],
[{ exportTab: false }],
[{}],
].forEach(props => {
it(`renders a tabbed dialog when more than one tab is provided`, () => { it(`renders a tabbed dialog when more than one tab is provided`, () => {
const wrapper = createComponent(props); const wrapper = createComponent(props);
assert.isTrue(wrapper.find('TabHeader').exists()); assert.isTrue(wrapper.find('TabHeader').exists());
assert.isTrue( assert.isTrue(
wrapper.find('Tab[aria-controls="share-panel"]').props().selected, wrapper.find(Tab).filter('[aria-controls="share-panel"]').props()
.selected,
); );
assert.isTrue(wrapper.find('TabPanel[id="share-panel"]').props().active); assert.isTrue(wrapper.find('TabPanel[id="share-panel"]').props().active);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment