-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
Fixes issue rjsf-team#2549.
There was a problem hiding this 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?
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. |
@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. |
Feel free to make a new PR based on this one with this test! Thanks for
writing it.
…--
Ashwin Ramaswami
On Wed, Oct 20, 2021 at 5:00 AM Joris W ***@***.***> wrote:
@henriksvensson <https://github.com/henriksvensson> I've written this
test, could you add it? Feel free to improve it if you want.
it("should pass uiSchema to custom wigdet", () => {
const CustomCheckboxWidget = ({ uiSchema }) => {
return <div id="custom-ui-option-value">{uiSchema.custom_field_key['ui:options'].test}</div>;
};
const { node } = createFormComponent({
schema: {
type: "boolean",
description: "my description",
},
widgets: {
CheckboxWidget: CustomCheckboxWidget
},
uiSchema: {
custom_field_key: {
'ui:widget': 'checkbox',
'ui:options': {
'test': 'foo'
}
}
}
});
expect(node.querySelector("#custom-ui-option-value").textContent).to.eql("foo");
});
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2550 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAM4MXY6E3ZAFTTX2X5EVQDUH2AKNANCNFSM5EEQFNMQ>
.
|
Closing in favor of #2587 |
Thanks for solving this, @jorisw! |
Fixes issue #2549.