diff --git a/package.json b/package.json index f1a17a2d7..8eec7f77a 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "test-storybook": "test-storybook", "storybook:axe": "yarn build-storybook && yarn storybook:axeOnly", "storybook:axeOnly": "axe-storybook --build-dir docs-build", - "test": "lerna run test", + "test": "lerna run test -- --detectOpenHandles", "test:updateSnapshots": "lerna run test -- -u", "namespace-check": "lerna run namespace-check", "prepare": "husky install", diff --git a/packages/components/src/core/InputCheckbox/__snapshots__/index.test.tsx.snap b/packages/components/src/core/InputCheckbox/__snapshots__/index.test.tsx.snap index 23b35bd91..944137490 100644 --- a/packages/components/src/core/InputCheckbox/__snapshots__/index.test.tsx.snap +++ b/packages/components/src/core/InputCheckbox/__snapshots__/index.test.tsx.snap @@ -3,20 +3,16 @@ exports[` Default story renders snapshot 1`] = `
- +
@@ -144,7 +143,7 @@ const LivePreviewDemo = (): JSX.Element => { export const LivePreview = { parameters: { - controls: { exclude: ["caption", "label"] }, + controls: { exclude: ["caption", "label", "stage"] }, snapshot: { skip: true, }, @@ -174,7 +173,7 @@ const TestDemo = (): JSX.Element => { />
- +
); @@ -185,7 +184,7 @@ export const Test = { id: testId, }, parameters: { - controls: { exclude: ["caption", "label", "id"] }, + controls: { exclude: ["caption", "label", "id", "stage"] }, snapshot: { skip: true, }, diff --git a/packages/components/src/core/InputCheckbox/index.tsx b/packages/components/src/core/InputCheckbox/index.tsx index 011dd261e..bc640127a 100644 --- a/packages/components/src/core/InputCheckbox/index.tsx +++ b/packages/components/src/core/InputCheckbox/index.tsx @@ -34,60 +34,32 @@ const InputCheckbox = (props: CheckboxProps): JSX.Element => { const { caption, checkboxProps, disabled, label, stage, value, ...rest } = props; - if (label === undefined || stage !== undefined) { - let newProps: MUICheckboxProps; - switch (stage) { - case "checked": - newProps = { - ...props, - checked: true, - color: "primary", - }; - break; - case "unchecked": - newProps = { - ...props, - checked: false, - color: "default", - }; - break; - case "indeterminate": - newProps = { - ...props, - checked: true, - color: "primary", - indeterminate: true, - }; - break; - default: - newProps = props; - } - return ( - - } - icon={ - - } - indeterminateIcon={ - - } - /> - ); + let newProps: MUICheckboxProps; + switch (stage) { + case "checked": + newProps = { + ...rest, + checked: true, + color: "primary", + }; + break; + case "unchecked": + newProps = { + ...rest, + checked: false, + color: "default", + }; + break; + case "indeterminate": + newProps = { + ...rest, + checked: true, + color: "primary", + indeterminate: true, + }; + break; + default: + newProps = rest; } return ( @@ -118,14 +90,12 @@ const InputCheckbox = (props: CheckboxProps): JSX.Element => { /> } {...checkboxProps} - {...rest} + {...newProps} /> } label={label} value={value} - > -
Content
- + /> ); };