Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/components/fields/BooleanField.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function BooleanField(props) {
<Widget
options={{ ...options, enumOptions }}
schema={schema}
uiSchema={uiSchema}
id={idSchema && idSchema.$id}
onChange={onChange}
onFocus={onFocus}
Expand Down
32 changes: 32 additions & 0 deletions packages/core/test/BooleanField_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,38 @@ describe("BooleanField", () => {
expect(description.textContent).eql("my description");
});

it("should pass uiSchema to custom widget", () => {
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"
);
});

it("should render the description using provided description field", () => {
const { node } = createFormComponent({
schema: {
Expand Down