Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac: migrate ChevronDown from enzyme to RTL #1961

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

import React from 'react';
import { shallow } from 'enzyme';
import { IoChevronDown } from 'react-icons/io5';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';

import ChevronDown from './ChevronDown';

Expand All @@ -24,14 +24,14 @@ describe('ChevronDown', () => {
const style = {
border: 'black solid 1px',
};
const wrapper = shallow(<ChevronDown className={className} style={style} />);
const { container } = render(<ChevronDown className={className} style={style} />);

expect(wrapper.hasClass(className)).toBe(true);
expect(wrapper.find(IoChevronDown).prop('style')).toBe(style);
expect(container.firstChild).toHaveClass(className);
expect(container.firstChild).toHaveStyle(style);
});

it('does not add `undefined` as a className when not given a className', () => {
const wrapper = shallow(<ChevronDown />);
expect(wrapper.hasClass('undefined')).toBe(false);
const { container } = render(<ChevronDown />);
expect(container.firstChild).not.toHaveClass('undefined');
});
});
Loading