Skip to content

Commit

Permalink
remove test as has no assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 30, 2019
1 parent 41fda03 commit d9c073d
Showing 1 changed file with 1 addition and 50 deletions.
51 changes: 1 addition & 50 deletions packages/material-ui-lab/src/Rating/Rating.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import { expect } from 'chai';
import { stub, spy } from 'sinon';
import { stub } from 'sinon';
import { createMount, getClasses } from '@material-ui/core/test-utils';
import describeConformance from '@material-ui/core/test-utils/describeConformance';
import { createClientRender, fireEvent } from 'test/utils/createClientRender';
import Rating from './Rating';
import Star from '../internal/svg-icons/Star';

describe('<Rating />', () => {
let mount;
Expand Down Expand Up @@ -67,52 +66,4 @@ describe('<Rating />', () => {
});
expect(container.querySelectorAll(`.${classes.iconHover}`).length).to.equal(2);
});

describe('prop: IconContainerComponent', () => {
it('should render with custom icons', () => {
function IconContainer() {
return (
<span>
<Star />
</span>
);
}
const { container } = render(
<Rating name="custom-icon-set" value={1} max={5} IconContainerComponent={IconContainer} />,
);
expect(container.querySelectorAll(`.${classes.label}`).length).to.equal(5);
});
});

it('should clear the rating', () => {
const handleChange = spy();
const { getByLabelText } = render(<Rating {...defaultProps} onChange={handleChange} />);

const input = getByLabelText('2 Stars');
fireEvent.click(input, {
clientX: 1,
});

expect(handleChange.callCount).to.equal(1);
expect(handleChange.args[0][1]).to.deep.equal(null);
});

it('should select the rating', () => {
const handleChange = spy();
const { getByLabelText } = render(<Rating {...defaultProps} onChange={handleChange} />);

const input = getByLabelText('3 Stars');
fireEvent.click(input);

expect(handleChange.callCount).to.equal(1);
expect(handleChange.args[0][1]).to.deep.equal(3);
});

it('should select the empty input if value is null', () => {
const { container, getByLabelText } = render(<Rating {...defaultProps} value={null} />);
const input = getByLabelText('Empty');
const checked = container.querySelector('input[name="rating-test"]:checked');
expect(input).to.equal(checked);
expect(input.value).to.equal('');
});
});

0 comments on commit d9c073d

Please sign in to comment.