Skip to content

Commit 577e222

Browse files
committed
Add more tests
1 parent a413181 commit 577e222

File tree

2 files changed

+19
-38
lines changed

2 files changed

+19
-38
lines changed

src/components/__tests__/TabPanel-test.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ describe('<TabPanel />', () => {
1111
};
1212
});
1313

14-
//it('should have sane defaults', () => {
15-
// const wrapper = shallow(<TabPanel>Hola</TabPanel>);
16-
17-
// expect(wrapper.hasClass('ReactTabs__TabPanel')).toBe(true);
18-
// expect(wrapper.prop('role')).toBe('tabpanel');
19-
// expect(wrapper.children().length).toBe(1);
20-
// expect(wrapper.children().length).toBe(0);
21-
//});
14+
it('should have sane defaults', () => {
15+
const wrapper = shallow(<TabPanel>Hola</TabPanel>);
16+
17+
expect(wrapper.hasClass('ReactTabs__TabPanel')).toBe(true);
18+
expect(wrapper.prop('role')).toBe('tabpanel');
19+
expect(wrapper.children().length).toBe(0);
20+
});
21+
22+
it('should render when selected', () => {
23+
const wrapper = shallow(<TabPanel selected>Hola</TabPanel>);
24+
25+
expect(wrapper.children().length).toBe(1);
26+
});
27+
28+
it('should render when forced', () => {
29+
const wrapper = shallow(<TabPanel forceRender>Hola</TabPanel>);
30+
31+
expect(wrapper.children().length).toBe(1);
32+
});
2233

2334
it('should accept className', () => {
2435
const wrapper = shallow(<TabPanel className="foobar" />);

src/components/__tests__/Tabs-test.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -157,36 +157,6 @@ describe('<Tabs />', () => {
157157
wrapper.childAt(0).childAt(3).simulate('click');
158158
assertTabSelected(wrapper, 0);
159159
});
160-
161-
// TODO: Can't seem to make this fail when removing fix :`(
162-
// See https://github.com/reactjs/react-tabs/pull/7
163-
// test('should preserve selectedIndex when typing', function () {
164-
// let App = React.createClass({
165-
// handleKeyDown: function () { this.forceUpdate(); },
166-
// render: function () {
167-
// return (
168-
// <Tabs ref="tabs" selectedIndex={1}>
169-
// <TabList>
170-
// <Tab>First</Tab>
171-
// <Tab>Second</Tab>
172-
// </TabList>
173-
// <TabPanel>1st</TabPanel>
174-
// <TabPanel><input onKeyDown={this.handleKeyDown}/></TabPanel>
175-
// </Tabs>
176-
// );
177-
// }
178-
// });
179-
//
180-
// let tabs = TestUtils.renderIntoDocument(<App/>).refs.tabs;
181-
// let input = tabs.getDOMNode().querySelector('input');
182-
//
183-
// input.focus();
184-
// TestUtils.Simulate.keyDown(input, {
185-
// keyCode: 'a'.charCodeAt()
186-
// });
187-
//
188-
// assertTabSelected(tabs, 1);
189-
// });
190160
});
191161

192162
describe('performance', () => {

0 commit comments

Comments
 (0)