Skip to content

Commit 4f02482

Browse files
markbmullinsepicfaace
authored andcommitted
Capitalized Yes and No defaults (rjsf-team#1395)
* Capitalized default Yes and No values in BooleanField * Capitalized expected default Yes and No values * Capitalized expected default Yes and No values in uiSchema_test
1 parent 83645ce commit 4f02482

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/core/src/components/fields/BooleanField.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function BooleanField(props) {
3636
enumOptions = optionsList({
3737
oneOf: schema.oneOf.map(option => ({
3838
...option,
39-
title: option.title || (option.const === true ? "yes" : "no"),
39+
title: option.title || (option.const === true ? "Yes" : "No"),
4040
})),
4141
});
4242
} else {
@@ -45,8 +45,8 @@ function BooleanField(props) {
4545
enumNames:
4646
schema.enumNames ||
4747
(schema.enum && schema.enum[0] === false
48-
? ["no", "yes"]
49-
: ["yes", "no"]),
48+
? ["No", "Yes"]
49+
: ["Yes", "No"]),
5050
});
5151
}
5252

packages/core/test/BooleanField_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ describe("BooleanField", () => {
255255
node.querySelectorAll(".field-radio-group label"),
256256
label => label.textContent
257257
);
258-
expect(labels).eql(["yes", "no"]);
258+
expect(labels).eql(["Yes", "No"]);
259259
});
260260

261261
it("should support enum option ordering for radio widgets", () => {
@@ -272,7 +272,7 @@ describe("BooleanField", () => {
272272
node.querySelectorAll(".field-radio-group label"),
273273
label => label.textContent
274274
);
275-
expect(labels).eql(["no", "yes"]);
275+
expect(labels).eql(["No", "Yes"]);
276276
});
277277

278278
it("should support enumNames for radio widgets", () => {

packages/core/test/uiSchema_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ describe("uiSchema", () => {
15661566
node => node.textContent
15671567
);
15681568

1569-
expect(labels).eql(["yes", "no"]);
1569+
expect(labels).eql(["Yes", "No"]);
15701570
});
15711571

15721572
it("should support formData", () => {
@@ -1634,8 +1634,8 @@ describe("uiSchema", () => {
16341634
it("should render boolean option labels", () => {
16351635
const { node } = createFormComponent({ schema, uiSchema });
16361636

1637-
expect(node.querySelectorAll("option")[1].textContent).eql("yes");
1638-
expect(node.querySelectorAll("option")[2].textContent).eql("no");
1637+
expect(node.querySelectorAll("option")[1].textContent).eql("Yes");
1638+
expect(node.querySelectorAll("option")[2].textContent).eql("No");
16391639
});
16401640

16411641
it("should update state when true is selected", () => {

0 commit comments

Comments
 (0)