Skip to content

Commit

Permalink
Rename test-utilities to test-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Sep 22, 2023
1 parent f115d2c commit 2a01525
Show file tree
Hide file tree
Showing 384 changed files with 362 additions and 419 deletions.
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
recursive: true,
timeout: (process.env.CIRCLECI === 'true' ? 5 : 2) * 1000, // Circle CI has low-performance CPUs.
reporter: 'dot',
require: ['@mui-internal/test-utilities/setupBabel', '@mui-internal/test-utilities/setupJSDOM'],
require: ['@mui-internal/test-utils/setupBabel', '@mui-internal/test-utils/setupJSDOM'],
'watch-ignore': [
// default
'.git',
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"@babel/plugin-transform-react-constant-elements": "^7.22.5",
"@babel/preset-typescript": "^7.22.15",
"@mui-internal/docs-utilities": "^1.0.0",
"@mui-internal/test-utilities": "^1.0.0",
"@mui-internal/test-utils": "^1.0.0",
"@types/autosuggest-highlight": "^3.2.0",
"@types/chai": "^4.3.5",
"@types/css-mediaquery": "^0.1.2",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/HighlightedCode.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui-internal/test-utilities';
import { createRenderer } from '@mui-internal/test-utils';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import { getDesignTokens } from 'docs/src/modules/brandingTheme';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const ruleTester = new eslint.RuleTester({
});
ruleTester.run('disallow-active-element-as-key-event-target', rule, {
valid: [
"import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyDown(getByRole('button'), { key: ' ' })",
"import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyDown(document.body, { key: 'Esc' })",
"import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyUp(document.body, { key: 'Tab' })",
"import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyDown(getByRole('button'), { key: ' ' })",
"import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyDown(document.body, { key: 'Esc' })",
"import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyUp(document.body, { key: 'Tab' })",
],
invalid: [
{
code: "import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyUp(document.activeElement, { key: 'LeftArrow' })",
code: "import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyUp(document.activeElement, { key: 'LeftArrow' })",
errors: [
{
message:
Expand All @@ -23,7 +23,7 @@ ruleTester.run('disallow-active-element-as-key-event-target', rule, {
],
},
{
code: "import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyDown(document.activeElement, { key: 'DownArrow' })",
code: "import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyDown(document.activeElement, { key: 'DownArrow' })",
errors: [
{
message:
Expand Down Expand Up @@ -54,7 +54,7 @@ ruleTester.run('disallow-active-element-as-key-event-target', rule, {
},
{
// test non-null assertion operator
code: "import { fireEvent } from '@mui-internal/test-utilities';\nfireEvent.keyUp(document.activeElement!, { key: 'LeftArrow' })",
code: "import { fireEvent } from '@mui-internal/test-utils';\nfireEvent.keyUp(document.activeElement!, { key: 'LeftArrow' })",
errors: [
{
message:
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"devDependencies": {
"@mui/material": "^5.14.10",
"@mui-internal/test-utilities": "^1.0.0",
"@mui-internal/test-utils": "^1.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/chai": "^4.3.5",
Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/Badge/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createRenderer,
createMount,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createRenderer, createMount, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { Badge, badgeClasses as classes } from '@mui/base/Badge';

describe('<Badge />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createRenderer,
describeConformanceUnstyled,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { expect } from 'chai';
import { spy } from 'sinon';
import { Button, buttonClasses } from '@mui/base/Button';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
fireEvent,
fireDiscreteEvent,
screen,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Portal } from '@mui/base/Portal';
import { ClickAwayListener } from '@mui/base/ClickAwayListener';

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { act, createRenderer } from '@mui-internal/test-utilities';
import { act, createRenderer } from '@mui-internal/test-utils';
import { Dropdown } from '@mui/base/Dropdown';
import { DropdownContext } from '@mui/base/useDropdown';
import { MenuButton } from '@mui/base/MenuButton';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/FocusTrap/FocusTrap.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { expect } from 'chai';
import { act, createRenderer, screen } from '@mui-internal/test-utilities';
import { act, createRenderer, screen } from '@mui-internal/test-utils';
import { FocusTrap } from '@mui/base/FocusTrap';
import { Portal } from '@mui/base/Portal';

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/FormControl/FormControl.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
createRenderer,
describeConformanceUnstyled,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { FormControl, formControlClasses, useFormControlContext } from '@mui/base/FormControl';

describe('<FormControl />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Input/Input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
describeConformanceUnstyled,
fireEvent,
screen,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { expect } from 'chai';
import { spy } from 'sinon';
import { Input, inputClasses } from '@mui/base/Input';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Menu/Menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
describeConformanceUnstyled,
fireEvent,
act,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Menu, menuClasses } from '@mui/base/Menu';
import { MenuItem } from '@mui/base/MenuItem';
import { DropdownContext, DropdownContextValue } from '@mui/base/useDropdown';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/MenuButton/MenuButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createRenderer,
describeConformanceUnstyled,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { MenuButton, menuButtonClasses } from '@mui/base/MenuButton';
import { DropdownContext, DropdownContextValue, DropdownActionTypes } from '@mui/base/useDropdown';

Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/MenuItem/MenuItem.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { MenuItem, menuItemClasses } from '@mui/base/MenuItem';
import { MenuProvider } from '@mui/base/useMenu';

Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/Modal/Modal.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { Modal, modalClasses as classes, ModalRootSlotProps } from '@mui/base/Modal';

describe('<Modal />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/NoSsr/NoSsr.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui-internal/test-utilities';
import { createRenderer } from '@mui-internal/test-utils';
import { NoSsr } from '@mui/base/NoSsr';

describe('<NoSsr />', () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/Option/Option.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { Option, optionClasses } from '@mui/base/Option';
import { SelectProvider } from '../useSelect/SelectProvider';

Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/OptionGroup/OptionGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { OptionGroup, optionGroupClasses } from '@mui/base/OptionGroup';

describe('<OptionGroup />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Popper/Popper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createMount,
describeConformanceUnstyled,
screen,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Popper, popperClasses } from '@mui/base/Popper';

describe('<Popper />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Portal/Portal.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { createRenderer } from '@mui-internal/test-utilities';
import { createRenderer } from '@mui-internal/test-utils';
import { Portal, PortalProps } from '@mui/base/Portal';

describe('<Portal />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Select/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
userEvent,
act,
screen,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Select, SelectListboxSlotProps, selectClasses } from '@mui/base/Select';
import { useOption, SelectOption } from '@mui/base/useOption';
import { Option, OptionProps, optionClasses } from '@mui/base/Option';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Slider/Slider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
describeConformanceUnstyled,
fireEvent,
screen,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import {
Slider,
sliderClasses as classes,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Snackbar/Snackbar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createMount,
describeConformanceUnstyled,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Snackbar, snackbarClasses as classes } from '@mui/base/Snackbar';

describe('<Snackbar />', () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/Switch/Switch.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { expect } from 'chai';
import { Switch, SwitchOwnerState, switchClasses } from '@mui/base/Switch';

Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/Tab/Tab.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { Tab, tabClasses } from '@mui/base/Tab';
import { TabsListProvider, TabsListProviderValue } from '../useTabsList';
import { TabsContext } from '../Tabs';
Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/TabPanel/TabPanel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { TabPanel, tabPanelClasses } from '@mui/base/TabPanel';
import { TabsProvider, TabsProviderValue } from '../useTabs';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
fireEvent,
createRenderer,
createMount,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import TableFooter from '@mui/material/TableFooter';
import TableRow from '@mui/material/TableRow';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Tabs/Tabs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
fireEvent,
screen,
createMount,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { Tab } from '@mui/base/Tab';
import { Tabs, tabsClasses as classes, TabsProps } from '@mui/base/Tabs';
import { TabsList } from '@mui/base/TabsList';
Expand Down
6 changes: 1 addition & 5 deletions packages/mui-base/src/TabsList/TabsList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import * as React from 'react';
import {
createMount,
createRenderer,
describeConformanceUnstyled,
} from '@mui-internal/test-utilities';
import { createMount, createRenderer, describeConformanceUnstyled } from '@mui-internal/test-utils';
import { TabsContext } from '@mui/base/Tabs';
import { TabsList, tabsListClasses } from '@mui/base/TabsList';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
createRenderer,
fireEvent,
strictModeDoubleLoggingSuppressed,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import { TextareaAutosize } from '@mui/base/TextareaAutosize';

function getStyleValue(value: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
createRenderer,
describeConformanceUnstyled,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import {
Unstable_NumberInput as NumberInput,
numberInputClasses,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Unstable_Popup/Popup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
describeConformanceUnstyled,
screen,
fireEvent,
} from '@mui-internal/test-utilities';
} from '@mui-internal/test-utils';
import {
Unstable_Popup as Popup,
popupClasses,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import userEvent from '@testing-library/user-event';
import { createRenderer, screen } from '@mui-internal/test-utilities';
import { createRenderer, screen } from '@mui-internal/test-utils';
import {
unstable_useNumberInput as useNumberInput,
UseNumberInputParameters,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import {
createRenderer,
screen,
ErrorBoundary,
act,
fireEvent,
} from '@mui-internal/test-utilities';
import { createRenderer, screen, ErrorBoundary, act, fireEvent } from '@mui-internal/test-utils';
import { spy } from 'sinon';
import { useAutocomplete, createFilterOptions } from '@mui/base/useAutocomplete';

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/useButton/useButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { act, createRenderer, fireEvent } from '@mui-internal/test-utilities';
import { act, createRenderer, fireEvent } from '@mui-internal/test-utils';
import { expect } from 'chai';
import { spy } from 'sinon';
import { useButton } from '@mui/base/useButton';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/useInput/useInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { act, createRenderer } from '@mui-internal/test-utilities';
import { act, createRenderer } from '@mui-internal/test-utils';
import { expect } from 'chai';
import { spy } from 'sinon';
import { useInput } from './useInput';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/useList/useList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { expect } from 'chai';
import { SinonSpy, spy } from 'sinon';
import { createRenderer, createEvent, fireEvent } from '@mui-internal/test-utilities';
import { createRenderer, createEvent, fireEvent } from '@mui-internal/test-utils';
import { useList } from './useList';

describe('useList', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/useSnackbar/useSnackbar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { fireEvent, createRenderer } from '@mui-internal/test-utilities';
import { fireEvent, createRenderer } from '@mui-internal/test-utils';
import { useSnackbar, UseSnackbarParameters } from '@mui/base/useSnackbar';

describe('useSnackbar', () => {
Expand Down
Loading

0 comments on commit 2a01525

Please sign in to comment.