Chore: convert NewWindowIcon test to rtl (#49830)

This commit is contained in:
Zoltán Bedi
2022-05-31 14:34:46 +02:00
committed by GitHub
parent 4c28d09d6d
commit 8e0342bc74
5 changed files with 9 additions and 28 deletions
@@ -12,29 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { shallow } from 'enzyme';
import { render } from '@testing-library/react';
import React from 'react';
import NewWindowIcon, { getStyles } from './NewWindowIcon';
describe('NewWindowIcon', () => {
const props = {
notIsLarge: 'not is large',
};
let wrapper;
beforeEach(() => {
wrapper = shallow(<NewWindowIcon {...props} />);
});
it('renders as expected', () => {
expect(wrapper).toMatchSnapshot();
});
it('adds is-large className when props.isLarge is true', () => {
const { container } = render(<NewWindowIcon isLarge />);
const styles = getStyles();
expect(wrapper.hasClass(styles.NewWindowIconLarge)).toBe(false);
wrapper.setProps({ isLarge: true });
expect(wrapper.hasClass(styles.NewWindowIconLarge)).toBe(true);
expect(container.firstChild).toHaveClass(styles.NewWindowIconLarge);
});
});
@@ -1,8 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`NewWindowIcon renders as expected 1`] = `
<IoAndroidOpen
className=""
notIsLarge="not is large"
/>
`;