Skip to content

Commit f15cfdf

Browse files
committed
fix: restore Jest setup after cheerio upgrade
+ ignore null children in toolbar collapse count
1 parent 66859f6 commit f15cfdf

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/__tests__/units/components/panel/info.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { render } from '@testing-library/react';
2+
import { render, screen } from '@testing-library/react';
33
import InfoPanel from '../../../../components/panel/info';
44
import configureStore from 'redux-mock-store'
55
import { Provider } from 'react-redux';

src/components/cmd_bar/collapsible_toolbar_group.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ const styles = () => ({
4242
},
4343
});
4444

45-
const countItems = (children) => (
46-
React.Children.toArray(children).filter((child) => child != null && child !== false).length
47-
);
45+
const countItems = (children) => React.Children.toArray(children).length;
4846

4947
const CollapsibleToolbarGroup = ({
5048
classes, className, children, collapseThreshold, ...rest

src/setupTests.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
const { TextDecoder, TextEncoder } = require('util');
2+
3+
if (typeof global.TextDecoder === 'undefined') {
4+
global.TextDecoder = TextDecoder;
5+
}
6+
if (typeof global.TextEncoder === 'undefined') {
7+
global.TextEncoder = TextEncoder;
8+
}
9+
110
const Enzyme = require('enzyme');
211
const AdapterModule = require('@wojtekmaj/enzyme-adapter-react-17');
312
const Adapter = AdapterModule.default || AdapterModule;

0 commit comments

Comments
 (0)