Skip to content

Commit

Permalink
Merge branch 'react-18' of github.com:tay1orjones/carbon into react-18
Browse files Browse the repository at this point in the history
  • Loading branch information
andreancardona committed Mar 15, 2023
2 parents b2a66a0 + 2bb3ed8 commit f42c9e5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
* 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 '../';

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"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<FileUploader />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
* 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';
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(<FileUploaderButton name="test" />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<FileUploaderSkeleton />);
Expand Down
4 changes: 1 addition & 3 deletions packages/react/src/components/Grid/__tests__/Grid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Grid as="section" />);
expect(container.firstChild.tagName).toBe('SECTION');
Expand Down
4 changes: 1 addition & 3 deletions packages/react/src/components/Grid/__tests__/Row-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Row as="section" />);
expect(container.firstChild.tagName).toBe('SECTION');
Expand Down
16 changes: 3 additions & 13 deletions packages/react/src/internal/__tests__/useId-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <span id={id}>test</span>;
}

const container = document.createElement('div');
const getTestId = () => container.firstChild.getAttribute('id');

render(<Test />, { container });

const id = getTestId();
expect(getTestId()).toBeDefined();

render(<Test />, { container });
expect(id).toBe(getTestId());
render(<Test />);
expect(screen.getByText('test')).toHaveAttribute('id', 'test-1');
});
});

0 comments on commit f42c9e5

Please sign in to comment.