diff --git a/.betterer.results b/.betterer.results index 66357fac2e3..69d2e61c0b9 100644 --- a/.betterer.results +++ b/.betterer.results @@ -8,9 +8,6 @@ exports[`no enzyme tests`] = { "packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx:4199795290": [ [0, 19, 13, "RegExp match", "2409514259"] ], - "packages/grafana-ui/src/components/FormField/FormField.test.tsx:3429087660": [ - [0, 19, 13, "RegExp match", "2409514259"] - ], "packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx:3129955645": [ [0, 19, 13, "RegExp match", "2409514259"] ], diff --git a/packages/grafana-ui/src/components/FormField/FormField.test.tsx b/packages/grafana-ui/src/components/FormField/FormField.test.tsx index 9cd91048024..ac95d812c75 100644 --- a/packages/grafana-ui/src/components/FormField/FormField.test.tsx +++ b/packages/grafana-ui/src/components/FormField/FormField.test.tsx @@ -1,4 +1,4 @@ -import { shallow } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; import { FormField, Props } from './FormField'; @@ -13,26 +13,20 @@ const setup = (propOverrides?: Partial) => { Object.assign(props, propOverrides); - return shallow(); + render(); }; describe('FormField', () => { - it('should render component with default inputEl', () => { - const wrapper = setup(); - - expect(wrapper).toMatchSnapshot(); + it('should render a default inputEl', () => { + setup(); + expect(screen.getByRole('textbox')).toBeInTheDocument(); }); - it('should render component with custom inputEl', () => { - const wrapper = setup({ - inputEl: ( - <> - Input - - - ), + it('should render a custom inputEl instead if specified', () => { + setup({ + inputEl: , }); - - expect(wrapper).toMatchSnapshot(); + expect(screen.queryByRole('textbox')).not.toBeInTheDocument(); + expect(screen.getByRole('checkbox')).toBeInTheDocument(); }); }); diff --git a/packages/grafana-ui/src/components/FormField/__snapshots__/FormField.test.tsx.snap b/packages/grafana-ui/src/components/FormField/__snapshots__/FormField.test.tsx.snap deleted file mode 100644 index b4d131f05d4..00000000000 --- a/packages/grafana-ui/src/components/FormField/__snapshots__/FormField.test.tsx.snap +++ /dev/null @@ -1,37 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`FormField should render component with custom inputEl 1`] = ` -
- - Test - - - Input - - -
-`; - -exports[`FormField should render component with default inputEl 1`] = ` -
- - Test - - -
-`;