Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

oneOf smart knob returns "--" as value of empty option #30

Closed

Description

@mhauens

if one set the defaultProp of an oneOf as "" instead of "--" the Story Source will show the option after selecting the option and the select the empty value again. Also Jest is complaining about this.

See the option "state":

<Radio
  label="Radio"
  id="radioId"
  testid="radioId"
  onChange={onChange}
  onBlur={onBlur}
  onFocus={onFocus}
  state="--"
/>
<Radio
  label="Radio"
  id="radioId"
  testid="radioId"
  onChange={onChange}
  onBlur={onBlur}
  onFocus={onFocus}
/>
Radio.defaultProps = {
    state: "",
};

Radio.propTypes = {
    state: PropTypes.oneOf(["success", "warning", "error"]),
}

My solution for now is to ad an "" to the oneOf

Radio.propTypes = {
    state: PropTypes.oneOf(["", "success", "warning", "error"]),
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions