Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Apr 15, 2023
1 parent 57a8d5d commit 7854792
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/mui-material/src/TextField/TextField.test.js
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, 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';
Expand Down Expand Up @@ -158,13 +158,15 @@ describe('<TextField />', () => {
describe('prop: disabled', () => {
it('should not run click event when disabled', () => {
const handleClick = spy();
render(<TextField disabled onClick={handleClick} />);
const { getByRole } = render(<TextField disabled onClick={handleClick} />);
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(<TextField disabled InputProps={{ onClick: handleClick }} />);
const { getByRole } = render(<TextField disabled InputProps={{ onClick: handleClick }} />);
fireEvent.click(getByRole('textbox'));
expect(handleClick.callCount).to.equal(0);
});
});
Expand Down

0 comments on commit 7854792

Please sign in to comment.