diff --git a/packages/mui-material/src/TextField/TextField.test.js b/packages/mui-material/src/TextField/TextField.test.js index 0bfd65e22a3700..1891e41b9df46b 100644 --- a/packages/mui-material/src/TextField/TextField.test.js +++ b/packages/mui-material/src/TextField/TextField.test.js @@ -1,7 +1,7 @@ import * as React from 'react'; import { expect } from 'chai'; import { spy } from 'sinon'; -import { createRenderer, describeConformance } from 'test/utils'; +import { createRenderer, describeConformance, fireEvent } from 'test/utils'; import FormControl from '@mui/material/FormControl'; import { inputBaseClasses } from '@mui/material/InputBase'; import MenuItem from '@mui/material/MenuItem'; @@ -158,13 +158,15 @@ describe('', () => { describe('prop: disabled', () => { it('should not run click event when disabled', () => { const handleClick = spy(); - render(); + const { getByRole } = render(); + fireEvent.click(getByRole('textbox')); expect(handleClick.callCount).to.equal(0); }); - it('should not run click event disabled and onClick prop is set through InputProps', () => { + it('should not run click event when disabled and when onClick prop is set through InputProps', () => { const handleClick = spy(); - render(); + const { getByRole } = render(); + fireEvent.click(getByRole('textbox')); expect(handleClick.callCount).to.equal(0); }); });