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
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ void testGetEnum() {

}

@Test
void testGetNullEnumNames() {
CheckBox checkbox = getCheckBoxUnderTest(PATH_CHECKBOX);
assertNull(checkbox.getEnumNames());
CheckBox noEnumCheckbox = getCheckBoxUnderTest(PATH_CHECKBOX_NOENUM);
assertNull(noEnumCheckbox.getEnumNames());
}

@Test
void testGetNullEnum() {
CheckBox noEnumCheckbox = getCheckBoxUnderTest(PATH_CHECKBOX_NOENUM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void testGetType() {
@Test
void testGetEnumNames() {
RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED);
assertArrayEquals(new String[] { "Item 1", "Item 2" }, radioButton.getEnumNames());
assertArrayEquals(new String[] { "<p>Item 1</p>", "<p>Item 2</p>" }, radioButton.getEnumNames());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"enforceEnum": true,
"enumNames": [
"Item 1",
"Item 2"
"<p>Item 1</p>",
Copy link
Collaborator

@rismehta rismehta Mar 19, 2024

Choose a reason for hiding this comment

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

Can you add a test case for use-case when the options are not rich text, in this case, json should not have

tag in it.

Copy link
Contributor Author

@im-shiv im-shiv Mar 19, 2024

Choose a reason for hiding this comment

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

we already have existing test cases in place for enum names in checkbox group, dropdown, switch etc which doesn't have rich text in enum names.

"<p>Item 2</p>"
],
"default": "0",
"screenReaderText": "'custom text'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "string",
"enforceEnum": true,
"enumNames": [
"Item 1",
"Item 2"
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"label": {
"value": "Radio Button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"orientation": "vertical",
"jcr:lastModifiedBy": "admin",
"jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530",
"areOptionsRichText": true,
"enum": [
"0",
"1"
],
"enumNames": [
"Item 1",
"Item 2"
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"jcr:lastModified": "Tue Sep 13 2022 15:18:50 GMT+0530",
"fieldType": "radio-group"
Expand All @@ -37,14 +38,15 @@
"dorColspan": "4",
"assistPriority": "custom",
"jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530",
"areOptionsRichText": true,
"enum": [
"0",
"1"
],
"type": "string",
"enumNames": [
"Item 1",
"Item 2"
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"visible": false,
"readOnly": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,21 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="Zauberer"/>
<_x0039_6b6493f-b93e-4b2d-8b38-3633a3fe6286
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Tier auswählen&lt;/b>&lt;/p>"/>
<fba2a273-8ffd-4286-87c8-120bab383d9e
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Hund&lt;/i>&lt;/p>"/>
<_x0037_c44f84b-8830-4270-ba63-8aa9de935572
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Katze&lt;/u>&lt;/p>"/>
<bb998be9-c330-493c-a5d3-e252a9ab8cc7
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,21 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="Hechicero"/>
<a6492758-b569-4c76-aaa1-29bf4b30cdfd
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Seleccionar animal&lt;/b>&lt;/p>"/>
<f51e320e-140a-4850-a65f-296944b9fabe
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Perro&lt;/i>&lt;/p>"/>
<_x0031_33de41e-050d-4628-8b22-34b8b6dfa9fa
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Gato&lt;/u>&lt;/p>"/>
<bb998be9-c330-493c-a5d3-e252a9ab8cc7
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="Sorcier"/>
<bf783b29-c90f-440c-a14b-11684a87ca79
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Sélectionner un animal&lt;/b>&lt;/p>"/>
<_x0037_e28c9de-7712-4f7b-969d-0c90f92935af
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Chien&lt;/i>&lt;/p>"/>
<_x0032_869e60b-f2eb-4e35-8d17-0673f7d870bc
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Chat&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="जादूगर"/>
<_x0035_3786ca1-ac18-4151-8e13-db1ec440cb44
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>पशु का चयन करें&lt;/b>&lt;/p>"/>
<a420bd56-ad98-43df-9477-75e455bc0103
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>कुत्ता&lt;/i>&lt;/p>"/>
<f733b6f8-a8d1-4025-9f6c-7cbde7accc0e
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>बिल्ली&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="mago"/>
<_x0038_fa19b1d-324d-453f-895f-60c86adb001c
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Seleziona animale&lt;/b>&lt;/p>"/>
<_x0030_ac73bc4-9c29-470f-9a99-a1c7f685a5b9
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Cane&lt;/i>&lt;/p>"/>
<_x0038_23d3ccb-d875-4a8d-9ff9-2a2859d7bdbd
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Gatto&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="魔法使い"/>
<_x0030_9640d23-a956-457d-82fa-671bf0750fce
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>動物を選択&lt;/b>&lt;/p>"/>
<cf37cd4a-00e4-4e91-886a-7c428b34c28f
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>犬&lt;/i>&lt;/p>"/>
<_x0038_a1f5c5f-4a24-4c48-a433-ce761870bbb1
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>猫&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="마법사"/>
<_x0030_d52109d-2260-4962-b0a4-a589fceb42cd
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>동물 선택&lt;/b>&lt;/p>"/>
<_x0030_ab74673-ed86-4d13-853e-86fbcb638588
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>개&lt;/i>&lt;/p>"/>
<b74e28f6-aa6a-4823-b87b-c45b0058d67d
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>고양이&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="mago"/>
<f680e4d1-ff1f-48f6-872d-cebd53fec33e
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Selecione Animal&lt;/b>&lt;/p>"/>
<_x0031_b25629c-4816-4847-a9d1-63e421b47930
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Cão&lt;/i>&lt;/p>"/>
<f0f38a3c-c391-4924-ba80-98bf8ec5e749
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Gato&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="колдун"/>
<cdf88ca7-c079-4f65-878d-0228f951d247
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>Выберите животное&lt;/b>&lt;/p>"/>
<cfcca183-f863-4d22-bc1f-2feffccda805
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>Собака&lt;/i>&lt;/p>"/>
<_x0038_d8b15a1-c3c9-4816-abd6-7e69bc3c477a
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>Кошка&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="巫师"/>
<_x0034_6fd8a2d-db44-4204-aca8-a4e8ecb178f7
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>选择动物&lt;/b>&lt;/p>"/>
<d2603a98-dd4b-4adf-a2b2-df99a7d8c00b
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>狗&lt;/i>&lt;/p>"/>
<_x0037_79cf790-b54b-429e-b5b2-ebed6ea0cbb7
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>猫&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,19 @@
jcr:primaryType="nt:folder"
sling:key="guideContainer##wizard##jcr:title##299"
sling:message="巫師"/>
<_x0036_0c96847-776f-406a-9de3-a669f70ca113
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##jcr:title##3329"
sling:message="&lt;p>&lt;b>選擇動物&lt;/b>&lt;/p>"/>
<_x0037_75e6e65-0828-4020-95f6-355249b69aaf
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##0"
sling:message="&lt;p>&lt;i>狗&lt;/i>&lt;/p>"/>
<_x0030_a911e93-4cd9-416d-ac7a-1f348014bbed
jcr:mixinTypes="[sling:Message]"
jcr:primaryType="nt:folder"
sling:key="guideContainer##checkboxgroup7##enumNames##7570##1"
sling:message="&lt;p>&lt;u>貓&lt;/u>&lt;/p>"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
enum="[0,1]"
enumNames="[Item 1, Item 2]"
fieldType="checkbox-group"
name="checkboxgroup1678442866069"
name="checkboxgroup1"
type="number[]"/>
<datepicker
fd:translationIds="\{&quot;jcr:title&quot;:&quot;guideContainer##datepicker##jcr:title##9506&quot;}"
Expand Down Expand Up @@ -215,6 +215,29 @@
sling:resourceType="forms-components-examples/components/form/wizard"
fieldType="panel"
name="wizard1678442986146"/>
<checkboxgroup7
fd:translationIds="\{&quot;jcr:title&quot;:&quot;guideContainer##checkboxgroup7##jcr:title##3329&quot;,&quot;enumNames&quot;:&quot;guideContainer##checkboxgroup7##enumNames##7570&quot;}"
jcr:created="{Date}2023-10-06T11:32:51.920+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2023-10-06T11:33:40.225+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="&lt;p>&lt;b>Select Animal&lt;/b>&lt;/p>"
sling:resourceType="forms-components-examples/components/form/checkboxgroup"
areOptionsRichText="true"
enabled="{Boolean}true"
enum="[0,1]"
enumNames="[&lt;p>&lt;i>Dog&lt;/i>&lt;/p>,&lt;p> &lt;u>Cat&lt;/u>&lt;/p>]"
fieldType="checkbox-group"
hideTitle="false"
isTitleRichText="true"
name="checkboxgroup2"
orientation="horizontal"
readOnly="{Boolean}false"
textIsRich="[true,true,true,true,true]"
type="number[]"
unboundFormElement="{Boolean}false"
visible="{Boolean}true"/>
</guideContainer>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@
textIsRich="[true,true]"
type="number[]"
visible="{Boolean}true"/>
<checkboxgroup7
jcr:created="{Date}2023-10-06T11:32:51.920+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2023-10-06T11:33:40.225+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="&lt;p>&lt;b>Select Animal&lt;/b>&lt;/p>"
sling:resourceType="forms-components-examples/components/form/checkboxgroup"
areOptionsRichText="true"
enabled="{Boolean}true"
enum="[0,1]"
enumNames="[&lt;p>&lt;i>Dog&lt;/i>&lt;/p>,&lt;p> &lt;u>Cat&lt;/u>&lt;/p>]"
fieldType="checkbox-group"
hideTitle="false"
isTitleRichText="true"
name="checkboxgroup_19427271491696572172217"
orientation="horizontal"
readOnly="{Boolean}false"
textIsRich="[true,true,true,true,true]"
type="number[]"
unboundFormElement="{Boolean}false"
visible="{Boolean}true"/>
</guideContainer>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
sling:resourceType="core/fd/components/form/toggleablelink/v1/toggleablelink"
enabled="{Boolean}true"
enum="http://localhost"
enumNames="[label for the link]"
enumNames="label for the link"
fieldType="checkbox-group"
hideTitle="false"
name="link1695211072051"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template data-sly-template.label="${@ componentId, labelValue, labelVisible, bemBlock}">
<template data-sly-template.label="${@ componentId, labelValue, labelVisible, labelRichText, bemBlock}">
<label for="${componentId}" class="${bemBlock}__label"
data-sly-test="${labelValue && (labelVisible==null || labelVisible==true)}">${labelValue}</label>
data-sly-test="${labelValue && (labelVisible==null || labelVisible==true)}" data-richtext="${labelRichText}">${labelValue @ context = labelRichText ? 'html' : 'text'}</label>
</template>
Loading