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

Make initialValue tests #218

Description

@m-bp

We need tests for initialValue across the board, mainly considering array and objectNamed({ ... }).ref(). Docs around both are also essential.

Original Ticket:
When you use an object as a field type you can pass initial values which will populate some fields.

Docs for reference.

    {
      title: 'Custom type',
      type: 'myCustomObjType',
      name: 'myCustomObjType',
      initialValue: {
        customName: "This is a custom name",
        customString: "This is a custom string"
      }
    },

Personally I use this on my CTA object to fill a hidden field which is then used to hide/show some extra customization options.

    {
      name: "style",
      title: "Style",
      type: s.string({
        initialValue: "primary",
        hidden: ({ parent }) => parent?.type === "link",
        options: {
          list: ["primary", "primary-light", "secondary", "tertiary", "link"],
        },
      }),
    },

At the moment my workaround is to have duplicated objects with different initialValues already defined but it's not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions