Skip to content

Commit 7c6792c

Browse files
committed
Fix failing test by using shallow instead of mount
Found the solution here: enzymejs/enzyme#1253
1 parent 0fac4ac commit 7c6792c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/testUtils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'; // eslint-disable-line no-unused-vars
2-
import { mount } from 'enzyme';
2+
import { mount, shallow } from 'enzyme';
33
import Datetime from '../DateTime'; // eslint-disable-line no-unused-vars
44

55
const simulateClickOnElement = (element) => {
@@ -16,6 +16,10 @@ module.exports = {
1616
return mount(<Datetime {...props} />);
1717
},
1818

19+
createDatetimeShallow: (props) => {
20+
return shallow(<Datetime {...props} />);
21+
},
22+
1923
/*
2024
* Click Simulations
2125
*/

test/tests.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ describe('Datetime', () => {
374374
expect(utils.isTimeView(component)).toBeTruthy();
375375
});
376376

377-
xit('className -> type string', () => {
378-
const component = utils.createDatetime({ className: 'custom-class' });
377+
it('className -> type string', () => {
378+
const component = utils.createDatetimeShallow({ className: 'custom-class' });
379379
expect(component.find('.custom-class').length).toEqual(1);
380380
});
381381

0 commit comments

Comments
 (0)