Skip to content

Commit

Permalink
RAC-225: fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenVAIDIE committed Sep 7, 2020
1 parent c63b3ed commit 089d951
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Expand Up @@ -40,7 +40,7 @@ Use this playground to test the checkbox component
<>
<Checkbox {...args} checked={true} label={'Checkbox checked'}/>
<Checkbox {...args} checked={false} undetermined={true} label={'Checkbox undetermined'}/>
<Checkbox {...args} checked={false} label={'Checkboxs unchecked'}/>
<Checkbox {...args} checked={false} label={'Checkbox unchecked'}/>
</>
)
}}
Expand Down
4 changes: 2 additions & 2 deletions akeneo-design-system/src/components/Checkbox/Checkbox.tsx
Expand Up @@ -62,7 +62,7 @@ type CheckboxProps = {
undetermined?: boolean,

/**
* Provide a description of the Checkbox, the label appear on the right of the checkboxes.
* Provide a description of the Checkbox, the label appears on the right of the checkboxes.
*/
label?: string,

Expand All @@ -77,7 +77,7 @@ type CheckboxProps = {
*/
const Checkbox = ({label, checked, onChange, undetermined = false, readOnly = false}: CheckboxProps) => {
if (undefined === onChange && false === readOnly) {
throw new Error('A Checkbox element expect a onChange attribute if not readOnly');
throw new Error('A Checkbox element expect an onChange attribute if not readOnly');
}

const handleChange = () => onChange && !readOnly && onChange(!checked);
Expand Down
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {fireEvent, render} from '@testing-library/react';
import {Checkbox} from './Checkbox';

it('it call onChange handler when user click on checkbox', () => {
it('it calls onChange handler when user clicks on checkbox', () => {
const onChange = jest.fn();
const {getByText} = render(
<Checkbox checked={true} onChange={onChange} label="Checkbox"/>
Expand All @@ -26,7 +26,7 @@ it('it does not call onChange handler when read-only', () => {
expect(onChange).not.toBeCalled();
});

it('it cannot be instantiate without handler when not readonly', () => {
it('it cannot be instantiated without handler when not readonly', () => {
expect(() => {
render(<Checkbox checked={true} label="Checkbox"/>);
}).toThrow('A Checkbox element expect a onChange attribute if not readOnly');
Expand Down
2 changes: 1 addition & 1 deletion akeneo-design-system/src/components/index.ts
@@ -1,2 +1,2 @@
export * from './Dummy/Dummy';
export * from './Checkbox/Checkbox';
export * from './Dummy/Dummy';

0 comments on commit 089d951

Please sign in to comment.