/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/mui-utils/src/appendOwnerState/appendOwnerState.test.ts
67 строк
2 KB
Jose C Quintas Jr
[code-infra] Vitest test migration (#44325)
01 дек 2025, 18:46
Не верифицирован
01 дек 2025, 18:46
83d2589
Код
Авторство
О чём код?
import { expect } from 'chai'; import appendOwnerState from '@mui/utils/appendOwnerState'; const ownerState = { className: 'bar', checked: true, }; function CustomComponent() { return null; } describe('appendOwnerState', () => { describe('when the provided elementType is undefined', () => { it('returns the provided existingProps without modification', () => { const existingProps = { className: 'foo' }; const actual = appendOwnerState(undefined, existingProps, ownerState); expect(actual).to.equal(existingProps); }); }); describe('when a DOM element is provided as elementType', () => { it('returns the provided existingProps without modification', () => { const existingProps = { className: 'foo' }; const actual = appendOwnerState('div', existingProps, ownerState); expect(actual).to.equal(existingProps); }); }); describe('when a React component is provided as elementType', () => { it('returns the provided existingProps with added ownerState', () => { const existingProps = { className: 'foo' }; const actual = appendOwnerState(CustomComponent, existingProps, ownerState); expect(actual).to.deep.equal({ className: 'foo', ownerState: { className: 'bar', checked: true, }, }); }); it('merges the provided ownerState with existing ones', () => { const existingProps = { ownerState: { className: 'foo', id: 'foo', }, className: 'foo', }; const actual = appendOwnerState(CustomComponent, existingProps, ownerState); expect(actual).to.deep.equal({ className: 'foo', ownerState: { className: 'bar', id: 'foo', checked: true, }, }); }); }); });