Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uiSchema to BooleanField widget #2550

Closed
wants to merge 1 commit into from

Conversation

henriksvensson
Copy link

Fixes issue #2549.

Copy link
Member

@epicfaace epicfaace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you add a quick test to ensure this doesn't regress in the future?

@jorisw
Copy link
Contributor

jorisw commented Oct 19, 2021

Could we just merge this? RJSF was broken to begin with in regards to this PR, and I don't see any other tests in core that test for the passing of the uiSchema prop to custom widgets.

@jorisw
Copy link
Contributor

jorisw commented Oct 20, 2021

@henriksvensson I've written this test, could you add it? Feel free to improve it if you want.

  // packages/core/test/BooleanField_test.js

  it("should pass uiSchema to custom Boolean widget", () => {
    const CustomCheckboxWidget = ({ uiSchema }) => {
      return <div id="custom-ui-option-value">{uiSchema.custom_widget_key['ui:options'].test}</div>;
    };

    const { node } = createFormComponent({
      schema: {
        type: "boolean",
        description: "my description",
      },
      widgets: {
        CheckboxWidget: CustomCheckboxWidget
      },
      uiSchema: {
        custom_widget_key: {
          'ui:widget': 'checkbox',
          'ui:options': {
            'test': 'foo'
          }
        }
      }
    });

    expect(node.querySelector("#custom-ui-option-value").textContent).to.eql("foo");
  });

Please also merge master so we can get this PR approved.

@epicfaace
Copy link
Member

epicfaace commented Oct 20, 2021 via email

@epicfaace
Copy link
Member

Closing in favor of #2587

@epicfaace epicfaace closed this Oct 20, 2021
@henriksvensson
Copy link
Author

Thanks for solving this, @jorisw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants