Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Apr 30, 2024
1 parent 39a2232 commit 82990ba
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions packages/pigment-css-react/tests/styled/runtime-styled.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,52 +263,51 @@ describe('props filtering', () => {
classes: ['InputBase-input'],
});

const InputBase = ({
function InputBase({
inputComponent = 'input',
slots = {},
slotProps = {},
inputProps: inputPropsProp = {},
}) => {
const Root = slots.root || InputBaseRoot;
}) {
const RootSlot = slots.root || InputBaseRoot;
const rootProps = slotProps.root || {};

let InputComponent = inputComponent;
let inputProps = inputPropsProp;
const InputComponent = inputComponent;

const Input = slots.input || InputBaseInput;
inputProps = { ...inputProps, ...slotProps.input };
const InputSlot = slots.input || InputBaseInput;
const inputProps = { ...inputPropsProp, ...slotProps.input };
return (
<Root
<RootSlot
{...rootProps}
{...(typeof Root !== 'string' && {
ownerState: rootProps.ownerState,
})}
>
<Input
<InputSlot
{...inputProps}
{...(typeof Input !== 'string' && {
as: InputComponent,
ownerState: inputProps.ownerState,
})}
/>
</Root>
</RootSlot>
);
};
}

const InputRoot = styled(InputBaseRoot, { name: 'MuiInput', slot: 'Root' })({
classes: ['Input-root'],
});
const InputInput = styled(InputBaseInput, { name: 'MuiInput', slot: 'Input' })({
classes: ['Input-input'],
});
const Input = ({
function Input({
inputComponent = 'input',
multiline = false,
slotProps,
slots = {},
type,
...other
}) => {
}) {
const RootSlot = slots.root ?? InputRoot;
const InputSlot = slots.input ?? InputInput;
return (
Expand All @@ -321,7 +320,7 @@ describe('props filtering', () => {
{...other}
/>
);
};
}

const defaultInput = <Input />;
const NativeSelectSelect = styled('select', {
Expand All @@ -330,7 +329,7 @@ describe('props filtering', () => {
})({
classes: ['NativeSelect-select'],
});
const NativeSelectInput = (props) => {
function NativeSelectInput(props) {
const { className, disabled, error, variant = 'standard', ...other } = props;

const ownerState = {
Expand All @@ -348,14 +347,8 @@ describe('props filtering', () => {
{...other}
/>
);
};
const NativeSelect = ({
className,
children,
input = defaultInput,
inputProps,
...other
}) => {
}
function NativeSelect({ className, children, input = defaultInput, inputProps, ...other }) {
return React.cloneElement(input, {
inputComponent: NativeSelectInput,
inputProps: {
Expand All @@ -367,7 +360,7 @@ describe('props filtering', () => {
...other,
className: `${input.props.className} ${className}`,
});
};
}

const { container } = render(
<NativeSelect>
Expand Down

0 comments on commit 82990ba

Please sign in to comment.