diff --git a/packages/react/src/components/CodeSnippet/__tests__/CodeSnippet.Skeleton-test.js b/packages/react/src/components/CodeSnippet/__tests__/CodeSnippet.Skeleton-test.js
index dd5688baf4d5..f06303da1fd4 100644
--- a/packages/react/src/components/CodeSnippet/__tests__/CodeSnippet.Skeleton-test.js
+++ b/packages/react/src/components/CodeSnippet/__tests__/CodeSnippet.Skeleton-test.js
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import React from 'react';
import { CodeSnippetSkeleton } from '../';
@@ -13,8 +13,6 @@ const prefix = 'cds';
const snippetTypes = ['single', 'multi'];
describe('CodeSnippetSkeleton', () => {
- afterEach(cleanup);
-
describe('automated accessibility testing', () => {
it.each(snippetTypes)(
'should have no Axe violations with type="%s"',
diff --git a/packages/react/src/components/FileUploader/__tests__/FileUploader-test.js b/packages/react/src/components/FileUploader/__tests__/FileUploader-test.js
index 62ad1d9253b0..663a290f7f22 100644
--- a/packages/react/src/components/FileUploader/__tests__/FileUploader-test.js
+++ b/packages/react/src/components/FileUploader/__tests__/FileUploader-test.js
@@ -6,14 +6,12 @@
*/
import { getByLabel, getByText } from '@carbon/test-utils/dom';
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import React from 'react';
import FileUploader from '../';
import { uploadFiles } from '../test-helpers';
describe('FileUploader', () => {
- afterEach(cleanup);
-
describe('automated accessibility tests', () => {
it.skip('should have no axe violations', async () => {
const { container } = render();
diff --git a/packages/react/src/components/FileUploader/__tests__/FileUploaderButton-test.js b/packages/react/src/components/FileUploader/__tests__/FileUploaderButton-test.js
index 36576daabca3..abfeaa61aac0 100644
--- a/packages/react/src/components/FileUploader/__tests__/FileUploaderButton-test.js
+++ b/packages/react/src/components/FileUploader/__tests__/FileUploaderButton-test.js
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import { getByText } from '@carbon/test-utils/dom';
import React from 'react';
import { Simulate } from 'react-dom/test-utils';
@@ -13,8 +13,6 @@ import { FileUploaderButton } from '../';
import { uploadFiles } from '../test-helpers';
describe('FileUploaderButton', () => {
- afterEach(cleanup);
-
describe('automated accessibility tests', () => {
it('should have no axe violations', async () => {
const { container } = render();
diff --git a/packages/react/src/components/FileUploader/__tests__/FileUploaderItem-test.js b/packages/react/src/components/FileUploader/__tests__/FileUploaderItem-test.js
index 129656b25abd..ecbd79021e66 100644
--- a/packages/react/src/components/FileUploader/__tests__/FileUploaderItem-test.js
+++ b/packages/react/src/components/FileUploader/__tests__/FileUploaderItem-test.js
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import { getByLabel, getByText } from '@carbon/test-utils/dom';
import React from 'react';
import { Simulate } from 'react-dom/test-utils';
@@ -15,8 +15,6 @@ import { keys } from '../../../internal/keyboard';
const statuses = ['uploading', 'edit', 'complete'];
describe('FileUploaderItem', () => {
- afterEach(cleanup);
-
describe('automated accessibility tests', () => {
it.each(statuses)(
'should have no axe violations with status %s',
diff --git a/packages/react/src/components/FileUploader/__tests__/FileUploaderSkeleton-test.js b/packages/react/src/components/FileUploader/__tests__/FileUploaderSkeleton-test.js
index 2c9bba181ecd..c4881dbc469c 100644
--- a/packages/react/src/components/FileUploader/__tests__/FileUploaderSkeleton-test.js
+++ b/packages/react/src/components/FileUploader/__tests__/FileUploaderSkeleton-test.js
@@ -5,13 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import React from 'react';
import { FileUploaderSkeleton } from '../';
describe('FileUploaderSkeleton', () => {
- afterEach(cleanup);
-
describe('automated accessibility testing', () => {
it('should have no axe violations', async () => {
const { container } = render();
diff --git a/packages/react/src/components/Grid/__tests__/Grid-test.js b/packages/react/src/components/Grid/__tests__/Grid-test.js
index 555371d859a9..e516cf8b1e97 100644
--- a/packages/react/src/components/Grid/__tests__/Grid-test.js
+++ b/packages/react/src/components/Grid/__tests__/Grid-test.js
@@ -5,13 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import React from 'react';
import { Grid } from '../';
describe('Grid', () => {
- afterEach(cleanup);
-
it('should support a custom element as the root node', () => {
const { container } = render();
expect(container.firstChild.tagName).toBe('SECTION');
diff --git a/packages/react/src/components/Grid/__tests__/Row-test.js b/packages/react/src/components/Grid/__tests__/Row-test.js
index cd8cd84a192a..e6a55e6b05b2 100644
--- a/packages/react/src/components/Grid/__tests__/Row-test.js
+++ b/packages/react/src/components/Grid/__tests__/Row-test.js
@@ -5,13 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render } from '@testing-library/react';
import React from 'react';
import { Row } from '../';
describe('Row', () => {
- afterEach(cleanup);
-
it('should support a custom element as the root node', () => {
const { container } = render(
);
expect(container.firstChild.tagName).toBe('SECTION');
diff --git a/packages/react/src/internal/__tests__/useId-test.js b/packages/react/src/internal/__tests__/useId-test.js
index 1e4a1576dc45..ce6160f81071 100644
--- a/packages/react/src/internal/__tests__/useId-test.js
+++ b/packages/react/src/internal/__tests__/useId-test.js
@@ -5,28 +5,18 @@
* LICENSE file in the root directory of this source tree.
*/
-import { render, cleanup } from '@carbon/test-utils/react';
+import { render, screen } from '@testing-library/react';
import React from 'react';
import { useId } from '../useId';
describe('useId', () => {
- afterEach(cleanup);
-
it('should generate a unique id that is stable across renders', () => {
function Test() {
const id = useId('test');
return test;
}
- const container = document.createElement('div');
- const getTestId = () => container.firstChild.getAttribute('id');
-
- render(, { container });
-
- const id = getTestId();
- expect(getTestId()).toBeDefined();
-
- render(, { container });
- expect(id).toBe(getTestId());
+ render();
+ expect(screen.getByText('test')).toHaveAttribute('id', 'test-1');
});
});