Skip to content

Commit

Permalink
createClientRender -> createRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 2, 2021
1 parent a531857 commit b5b2e12
Show file tree
Hide file tree
Showing 211 changed files with 546 additions and 1,011 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, screen, ErrorBoundary, act, fireEvent } from 'test/utils';
import { createRenderer, screen, ErrorBoundary, act, fireEvent } from 'test/utils';
import { useAutocomplete, createFilterOptions } from '@mui/core/AutocompleteUnstyled';

describe('useAutocomplete', () => {
const render = createClientRender();
const { render } = createRenderer();

it('should preserve DOM nodes of options when re-ordering', () => {
const Test = (props) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import BackdropUnstyled, { backdropUnstyledClasses as classes } from '@mui/core/BackdropUnstyled';

describe('<BackdropUnstyled />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(
<BackdropUnstyled>
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/BadgeUnstyled/BadgeUnstyled.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import BadgeUnstyled, { badgeUnstyledClasses as classes } from '@mui/core/BadgeUnstyled';

describe('<BadgeUnstyled />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(
<BadgeUnstyled>
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/ButtonUnstyled/ButtonUnstyled.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { createMount, createClientRender, describeConformanceUnstyled } from 'test/utils';
import { createMount, createRenderer, describeConformanceUnstyled } from 'test/utils';
import ButtonUnstyled, { buttonUnstyledClasses } from '@mui/core/ButtonUnstyled';
import { expect } from 'chai';

describe('<ButtonUnstyled />', () => {
const mount = createMount();
const render = createClientRender();
const { render } = createRenderer();

describeConformanceUnstyled(<ButtonUnstyled />, () => ({
inheritComponent: 'button',
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/ButtonUnstyled/useButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { useButton } from '@mui/core/ButtonUnstyled';
import { createClientRender, fireEvent } from 'test/utils';
import { createRenderer, fireEvent } from 'test/utils';
import { expect } from 'chai';
import { spy } from 'sinon';

describe('useButton', () => {
const render = createClientRender();
const { render } = createRenderer();

describe('state: active', () => {
describe('when using a button element', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { expect } from 'chai';
import { spy, useFakeTimers } from 'sinon';
import { act, createClientRender, fireEvent, fireDiscreteEvent, screen } from 'test/utils';
import { act, createRenderer, fireEvent, fireDiscreteEvent, screen } from 'test/utils';
import Portal from '@mui/core/Portal';
import ClickAwayListener from '@mui/core/ClickAwayListener';

Expand All @@ -19,7 +19,7 @@ describe('<ClickAwayListener />', () => {
clock.restore();
});

const clientRender = createClientRender();
const { render: clientRender } = createRenderer();
/**
* @type {typeof plainRender extends (...args: infer T) => any ? T : enver} args
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import {
createMount,
createClientRender,
describeConformanceUnstyled,
fireEvent,
} from 'test/utils';
import { createMount, createRenderer, describeConformanceUnstyled, fireEvent } from 'test/utils';
import FormControlUnstyled, {
formControlUnstyledClasses,
useFormControlUnstyled,
} from '@mui/core/FormControlUnstyled';

describe('<FormControlUnstyled />', () => {
const mount = createMount();
const render = createClientRender();
const { render } = createRenderer();

describeConformanceUnstyled(<FormControlUnstyled />, () => ({
inheritComponent: 'div',
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/InputUnstyled/InputUnstyled.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { createMount, createClientRender, describeConformanceUnstyled } from 'test/utils';
import { createMount, createRenderer, describeConformanceUnstyled } from 'test/utils';
import InputUnstyled, { inputUnstyledClasses } from '@mui/core/InputUnstyled';

describe('<InputUnstyled />', () => {
const mount = createMount();
const render = createClientRender();
const { render } = createRenderer();

describeConformanceUnstyled(<InputUnstyled />, () => ({
inheritComponent: 'div',
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/ModalUnstyled/ModalUnstyled.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import ModalUnstyled, { modalUnstyledClasses as classes } from '@mui/core/ModalUnstyled';

describe('<ModalUnstyled />', () => {
const render = createClientRender();
const { render } = createRenderer();
let savedBodyStyle;

before(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/NoSsr/NoSsr.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, createServerRender } from 'test/utils';
import { createRenderer, createServerRender } from 'test/utils';
import NoSsr from '@mui/core/NoSsr';

describe('<NoSsr />', () => {
const render = createClientRender();
const { render } = createRenderer();
const serverRender = createServerRender({ expectUseLayoutEffectWarning: true });

describe('server-side rendering', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/Popper/Popper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import * as React from 'react';
import { expect } from 'chai';
import { useFakeTimers } from 'sinon';
import PropTypes from 'prop-types';
import { describeConformance, act, createClientRender, fireEvent, screen } from 'test/utils';
import { describeConformance, act, createRenderer, fireEvent, screen } from 'test/utils';
import { ThemeProvider, createTheme } from '@mui/system';
import Grow from '@mui/material/Grow';
import Popper from '@mui/core/Popper';

describe('<Popper />', () => {
let rtlTheme;
const render = createClientRender();
const { render } = createRenderer();
const defaultProps = {
anchorEl: () => document.createElement('svg'),
children: <span>Hello World</span>,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/Portal/Portal.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { expect } from 'chai';
import { spy } from 'sinon';
import { createServerRender, createClientRender } from 'test/utils';
import { createServerRender, createRenderer } from 'test/utils';
import Portal from './Portal';

describe('<Portal />', () => {
const serverRender = createServerRender({ expectUseLayoutEffectWarning: true });
const render = createClientRender();
const { render } = createRenderer();

describe('server-side', () => {
before(function beforeHook() {
Expand Down
10 changes: 2 additions & 8 deletions packages/mui-core/src/SliderUnstyled/SliderUnstyled.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import SliderUnstyled, { sliderUnstyledClasses as classes } from '@mui/core/Slid
import { expect } from 'chai';
import * as React from 'react';
import { spy, stub } from 'sinon';
import {
createClientRender,
createMount,
describeConformance,
fireEvent,
screen,
} from 'test/utils';
import { createRenderer, createMount, describeConformance, fireEvent, screen } from 'test/utils';

describe('<SliderUnstyled />', () => {
before(function beforeHook() {
Expand All @@ -18,7 +12,7 @@ describe('<SliderUnstyled />', () => {
});

const mount = createMount();
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<SliderUnstyled value={0} />, () => ({
classes,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/SwitchUnstyled/SwitchUnstyled.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { createMount, createClientRender, describeConformanceUnstyled } from 'test/utils';
import { createMount, createRenderer, describeConformanceUnstyled } from 'test/utils';
import SwitchUnstyled, { SwitchState, switchUnstyledClasses } from '@mui/core/SwitchUnstyled';
import { expect } from 'chai';

describe('<SwitchUnstyled />', () => {
const mount = createMount();
const render = createClientRender();
const { render } = createRenderer();

describeConformanceUnstyled(<SwitchUnstyled />, () => ({
inheritComponent: 'span',
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-core/src/SwitchUnstyled/useSwitch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { spy } from 'sinon';
import {
act,
createClientRender,
createRenderer,
focusVisible,
programmaticFocusTriggersFocusVisible,
screen,
Expand All @@ -12,7 +12,7 @@ import {
import { useSwitch, UseSwitchProps, UseSwitchResult } from '@mui/core/SwitchUnstyled';

describe('useSwitch', () => {
const render = createClientRender();
const { render } = createRenderer();
const invokeUseSwitch = (props: UseSwitchProps): UseSwitchResult => {
const ref = React.createRef<UseSwitchResult>();
function TestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import sinon, { spy, stub, useFakeTimers } from 'sinon';
import {
describeConformance,
act,
createClientRender,
createRenderer,
fireEvent,
strictModeDoubleLoggingSupressed,
} from 'test/utils';
import TextareaAutosize from '@mui/core/TextareaAutosize';

describe('<TextareaAutosize />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<TextareaAutosize />, () => ({
inheritComponent: 'textarea',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { useFakeTimers } from 'sinon';
import { expect } from 'chai';
import { act, createClientRender, screen } from 'test/utils';
import { act, createRenderer, screen } from 'test/utils';
import TrapFocus from '@mui/core/Unstable_TrapFocus';
import Portal from '@mui/core/Portal';

describe('<TrapFocus />', () => {
const render = createClientRender();
const { render } = createRenderer();

let initialFocus = null;

Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/src/styles/CssVarsProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, screen } from 'test/utils';
import { createRenderer, screen } from 'test/utils';
import { styled, CssVarsProvider, useTheme } from '@mui/joy/styles';
import defaultTheme from './defaultTheme';

describe('[Joy] CssVarsProvider', () => {
let originalMatchmedia: typeof window.matchMedia;
const render = createClientRender();
const { render } = createRenderer();
const storage: Record<string, string> = {};
beforeEach(() => {
originalMatchmedia = window.matchMedia;
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/src/styles/ThemeProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender } from 'test/utils';
import { createRenderer } from 'test/utils';
import { ThemeProvider, useTheme } from '@mui/joy/styles';
import defaultTheme from './defaultTheme';

describe('[Joy] ThemeProvider', () => {
const render = createClientRender();
const { render } = createRenderer();
it('can render component without ThemeProvider', () => {
const Text = () => {
const theme = useTheme();
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-joy/src/styles/styled.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender } from 'test/utils';
import { createRenderer } from 'test/utils';
import { ThemeProvider, styled } from '@mui/joy/styles';
import defaultTheme from './defaultTheme';

const toPixel = (val: string | number | undefined) => (typeof val === 'number' ? `${val}px` : val);

describe('[Joy] styled', () => {
const render = createClientRender();
const { render } = createRenderer();
it('use defaultTheme given no ThemeProvider', function test() {
if (/jsdom/.test(window.navigator.userAgent)) {
this.skip();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import CalendarPickerSkeleton, {
calendarPickerSkeletonClasses as classes,
} from '@mui/lab/CalendarPickerSkeleton';

describe('<CalendarPickerSkeleton />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<CalendarPickerSkeleton />, () => ({
classes,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/src/LoadingButton/LoadingButton.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { createClientRender, describeConformance, screen } from 'test/utils';
import { createRenderer, describeConformance, screen } from 'test/utils';
import { expect } from 'chai';
import Button from '@mui/material/Button';
import LoadingButton, { loadingButtonClasses as classes } from '@mui/lab/LoadingButton';

describe('<LoadingButton />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<LoadingButton>Conformance?</LoadingButton>, () => ({
classes,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/src/Masonry/Masonry.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import Masonry, { masonryClasses as classes } from '@mui/lab/Masonry';
import { expect } from 'chai';
import { createTheme } from '@mui/material/styles';
import { getStyle, parseToNumber } from './Masonry';

describe('<Masonry />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(
<Masonry>
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/src/TabList/TabList.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @ts-check
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import Tab from '@mui/material/Tab';
import Tabs, { tabsClasses as classes } from '@mui/material/Tabs';
import TabList from './TabList';
import TabContext from '../TabContext';

describe('<TabList />', () => {
const render = createClientRender();
const { render } = createRenderer();

// @ts-ignore mui name does not exist for this component
describeConformance(<TabList />, () => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/src/TabPanel/TabPanel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { expect } from 'chai';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import TabPanel, { tabPanelClasses as classes } from '@mui/lab/TabPanel';
import TabContext from '../TabContext';

describe('<TabPanel />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<TabPanel value="0" />, () => ({
classes,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-lab/src/Timeline/Timeline.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { createClientRender, describeConformance } from 'test/utils';
import { createRenderer, describeConformance } from 'test/utils';
import Timeline, { timelineClasses as classes } from '@mui/lab/Timeline';

describe('<Timeline />', () => {
const render = createClientRender();
const { render } = createRenderer();

describeConformance(<Timeline />, () => ({
classes,
Expand Down
Loading

0 comments on commit b5b2e12

Please sign in to comment.