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
2 changes: 1 addition & 1 deletion .circleci/ci/accessibilityConfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"accessibilityExceptionList": ["landmark-one-main", "label-title-only", "region", "focus-order-semantics", "target-size"]
"accessibilityExceptionList": ["landmark-one-main", "label-title-only", "region", "focus-order-semantics", "target-size", "page-has-heading-one"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ public String getScreenReaderText() {
if (AssistPriority.LABEL.equals(assistPriority)) {
Label label = getLabel();
if (label != null) {
screenReaderText = "$label.$value";
screenReaderText = label.getValue();
}
} else if (AssistPriority.NAME.equals(assistPriority)) {
screenReaderText = "$name";
screenReaderText = getName();
} else if (AssistPriority.DESCRIPTION.equals(assistPriority)) {
screenReaderText = "$description";
screenReaderText = getDescription();
} else if (AssistPriority.CUSTOM.equals(assistPriority)) {
screenReaderText = "'" + customAssistPriorityMsg + "'"; // json formula string literal
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class RadioButtonImplTest {
private static final String BASE = "/form/radiobutton";
private static final String CONTENT_ROOT = "/content";
private static final String PATH_RADIOBUTTON_CUSTOMIZED = CONTENT_ROOT + "/radiobutton-customized";
private static final String PATH_RADIOBUTTON_CUSTOMIZED_WITH_LABEL = CONTENT_ROOT + "/radiobutton-customized-withLabel";
private static final String PATH_RADIOBUTTON_CUSTOMIZED_WITH_NAME = CONTENT_ROOT + "/radiobutton-customized-withName";
private static final String PATH_RADIOBUTTON_CUSTOMIZED_WITH_DESC = CONTENT_ROOT + "/radiobutton-customized-withDescription";
private static final String PATH_RADIOBUTTON = CONTENT_ROOT + "/radiobutton";
private static final String PATH_RADIOBUTTON_DATALAYER = CONTENT_ROOT + "/radiobutton-datalayer";

Expand Down Expand Up @@ -390,4 +393,31 @@ void testInsertionOrderForEnumNames() {
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty"));
assertArrayEquals(set.toArray(new String[0]), radioButton.getEnumNames());
}

@Test
void testGetScreenReaderTextWithLabel() {
RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED_WITH_LABEL);
assertEquals("Radio Button", radioButton.getScreenReaderText());
RadioButton radioButtonMock = Mockito.mock(RadioButton.class);
Mockito.when(radioButtonMock.getScreenReaderText()).thenCallRealMethod();
assertEquals(null, radioButtonMock.getScreenReaderText());
}

@Test
void testGetScreenReaderTextWithName() {
RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED_WITH_NAME);
assertEquals("radiobutton_12345", radioButton.getScreenReaderText());
RadioButton radioButtonMock = Mockito.mock(RadioButton.class);
Mockito.when(radioButtonMock.getScreenReaderText()).thenCallRealMethod();
assertEquals(null, radioButtonMock.getScreenReaderText());
}

@Test
void testGetScreenReaderTextWithDescription() {
RadioButton radioButton = getRadioButtonUnderTest(PATH_RADIOBUTTON_CUSTOMIZED_WITH_DESC);
assertEquals("long description", radioButton.getScreenReaderText());
RadioButton radioButtonMock = Mockito.mock(RadioButton.class);
Mockito.when(radioButtonMock.getScreenReaderText()).thenCallRealMethod();
assertEquals(null, radioButtonMock.getScreenReaderText());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id": "radiobutton-3b6e1ca0f6",
"dataRef": "a.b",
"fieldType": "radio-group",
"name": "radiobutton_12345",
"visible": false,
"description": "long description",
"tooltip": "<p>short description</p>",
"type": "string",
"required": true,
"enabled": true,
"readOnly": true,
"constraintMessages": {
"required": "This is a required field",
"validationExpression": "Required Expression"
},
"enforceEnum": true,
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"default": "0",
"screenReaderText": "long description",
"label": {
"value": "Radio Button"
},
"events": {
"custom:setProperty": [
"$event.payload"
]
},
"properties": {
"afs:layout": {
"tooltipVisible": true,
"orientation": "vertical"
},
"fd:dor": {
"dorExclusion": true,
"dorColspan": "4"
},
"fd:path": "/content/radiobutton-customized"
},
"enum": [
"0",
"1"
],
":type": "core/fd/components/form/radiobutton/v1/radiobutton"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id": "radiobutton-3b6e1ca0f6",
"dataRef": "a.b",
"fieldType": "radio-group",
"name": "radiobutton_12345",
"visible": false,
"description": "long description",
"tooltip": "<p>short description</p>",
"type": "string",
"required": true,
"enabled": true,
"readOnly": true,
"constraintMessages": {
"required": "This is a required field",
"validationExpression": "Required Expression"
},
"enforceEnum": true,
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"default": "0",
"screenReaderText": "'Radio Button'",
"label": {
"value": "Radio Button"
},
"events": {
"custom:setProperty": [
"$event.payload"
]
},
"properties": {
"afs:layout": {
"tooltipVisible": true,
"orientation": "vertical"
},
"fd:dor": {
"dorExclusion": true,
"dorColspan": "4"
},
"fd:path": "/content/radiobutton-customized"
},
"enum": [
"0",
"1"
],
":type": "core/fd/components/form/radiobutton/v1/radiobutton"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id": "radiobutton-3b6e1ca0f6",
"dataRef": "a.b",
"fieldType": "radio-group",
"name": "radiobutton_12345",
"visible": false,
"description": "long description",
"tooltip": "<p>short description</p>",
"type": "string",
"required": true,
"enabled": true,
"readOnly": true,
"constraintMessages": {
"required": "This is a required field",
"validationExpression": "Required Expression"
},
"enforceEnum": true,
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"default": "0",
"screenReaderText": "radiobutton_12345",
"label": {
"value": "Radio Button"
},
"events": {
"custom:setProperty": [
"$event.payload"
]
},
"properties": {
"afs:layout": {
"tooltipVisible": true,
"orientation": "vertical"
},
"fd:dor": {
"dorExclusion": true,
"dorColspan": "4"
},
"fd:path": "/content/radiobutton-customized"
},
"enum": [
"0",
"1"
],
":type": "core/fd/components/form/radiobutton/v1/radiobutton"
}
123 changes: 123 additions & 0 deletions bundles/af-core/src/test/resources/form/radiobutton/test-content.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,128 @@
"20"
],
":type": "forms-components-examples/components/form/radiobutton"
},
"radiobutton-customized-withLabel": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "core/fd/components/form/radiobutton/v1/radiobutton",
"name": "radiobutton_12345",
"jcr:title": "Radio Button",
"jcr:createdBy": "admin",
"description": "long description",
"enabled": true,
"orientation": "vertical",
"dataRef": "a.b",
"custom": "custom text",
"jcr:lastModifiedBy": "admin",
"tooltip": "<p>short description</p>",
"required": "true",
"dorExclusion": true,
"dorColspan": "4",
"assistPriority": "label",
"jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530",
"areOptionsRichText": true,
"enum": [
"0",
"1"
],
"type": "string",
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"visible": false,
"readOnly": true,
"jcr:lastModified": "Tue Sep 13 2022 15:18:50 GMT+0530",
"fieldType": "radio-group",
"mandatoryMessage": "This is a required field",
"default": "0",
"tooltipVisible": "true",
"textIsRich": [
"true",
"true"
],
"validateExpMessage": "Required Expression"
},
"radiobutton-customized-withName": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "core/fd/components/form/radiobutton/v1/radiobutton",
"name": "radiobutton_12345",
"jcr:title": "Radio Button",
"jcr:createdBy": "admin",
"description": "long description",
"enabled": true,
"orientation": "vertical",
"dataRef": "a.b",
"custom": "custom text",
"jcr:lastModifiedBy": "admin",
"tooltip": "<p>short description</p>",
"required": "true",
"dorExclusion": true,
"dorColspan": "4",
"assistPriority": "name",
"jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530",
"areOptionsRichText": true,
"enum": [
"0",
"1"
],
"type": "string",
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"visible": false,
"readOnly": true,
"jcr:lastModified": "Tue Sep 13 2022 15:18:50 GMT+0530",
"fieldType": "radio-group",
"mandatoryMessage": "This is a required field",
"default": "0",
"tooltipVisible": "true",
"textIsRich": [
"true",
"true"
],
"validateExpMessage": "Required Expression"
},
"radiobutton-customized-withDescription": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "core/fd/components/form/radiobutton/v1/radiobutton",
"name": "radiobutton_12345",
"jcr:title": "Radio Button",
"jcr:createdBy": "admin",
"description": "long description",
"enabled": true,
"orientation": "vertical",
"dataRef": "a.b",
"custom": "custom text",
"jcr:lastModifiedBy": "admin",
"tooltip": "<p>short description</p>",
"required": "true",
"dorExclusion": true,
"dorColspan": "4",
"assistPriority": "description",
"jcr:created": "Tue Sep 13 2022 15:17:35 GMT+0530",
"areOptionsRichText": true,
"enum": [
"0",
"1"
],
"type": "string",
"enumNames": [
"<p>Item 1</p>",
"<p>Item 2</p>"
],
"visible": false,
"readOnly": true,
"jcr:lastModified": "Tue Sep 13 2022 15:18:50 GMT+0530",
"fieldType": "radio-group",
"mandatoryMessage": "This is a required field",
"default": "0",
"tooltipVisible": "true",
"textIsRich": [
"true",
"true"
],
"validateExpMessage": "Required Expression"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
sling:resourceType="forms-components-examples/components/form/panelcontainer"
enabled="{Boolean}true"
fieldType="panel"
hideTitle="false"
hideTitle="true"
name="panelcontainer1684928145531"
readOnly="{Boolean}false"
repeatable="false"
Expand Down
Loading