Skip to content

Commit 58b8b2c

Browse files
authored
Merge pull request #515 from Esri/df/formViewAddGroupElementDescriptions
`FormView` - Add group element descriptions
2 parents 7d37ddc + f2258e9 commit 58b8b2c

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

Sources/ArcGISToolkit/Components/FormView/GroupView.swift

+9-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ struct GroupView<Content>: View where Content: View {
5050

5151
var body: some View {
5252
DisclosureGroup(self.element.label, isExpanded: $isExpanded) {
53-
ForEach(visibleElements, id: \.label) { formElement in
54-
if let element = formElement as? FieldFormElement {
55-
viewCreator(element)
53+
Group {
54+
Text(element.description)
55+
.accessibilityIdentifier("\(element.label) Description")
56+
.font(.subheadline)
57+
Divider()
58+
ForEach(visibleElements, id: \.label) { formElement in
59+
if let element = formElement as? FieldFormElement {
60+
viewCreator(element)
61+
}
5662
}
5763
}
5864
// Reapply leading alignment for content within the DisclosureGroup

UI Test Runner/UITests/FormViewTests.swift

+22
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,7 @@ final class FormViewTests: XCTestCase {
12741274
let collapsedGroup = app.disclosureTriangles["Group with Multiple Form Elements 2"]
12751275
let expandedGroupFirstElement = app.staticTexts["MultiLine Text"]
12761276
let expandedGroup = app.disclosureTriangles["Group with Multiple Form Elements"]
1277+
let expandedGroupDescription = app.staticTexts["Group with Multiple Form Elements Description"]
12771278
let formTitle = app.staticTexts["group_formelement_UI_not_editable"]
12781279
let formViewTestsButton = app.buttons["FormView Tests"]
12791280

@@ -1295,6 +1296,16 @@ final class FormViewTests: XCTestCase {
12951296
"The first group header doesn't exist."
12961297
)
12971298

1299+
XCTAssertTrue(
1300+
expandedGroupDescription.exists,
1301+
"The expanded group's description doesn't exist."
1302+
)
1303+
1304+
XCTAssertEqual(
1305+
expandedGroupDescription.label,
1306+
"This Group is 'Expand initial state'\nThis group is Visible"
1307+
)
1308+
12981309
// Confirm the first element of the expanded group exists.
12991310
XCTAssertTrue(
13001311
expandedGroupFirstElement.exists,
@@ -1320,6 +1331,7 @@ final class FormViewTests: XCTestCase {
13201331
let formViewTestsButton = app.buttons["FormView Tests"]
13211332
let showElementsButton = app.buttons["show invisible form element"]
13221333
let hiddenElementsGroup = app.disclosureTriangles["Group with children that are visible dependent"]
1334+
let hiddenElementsGroupDescription = app.staticTexts["Group with children that are visible dependent Description"]
13231335
let groupElement = app.staticTexts["single line text 3"]
13241336

13251337
app.launch()
@@ -1340,6 +1352,16 @@ final class FormViewTests: XCTestCase {
13401352
"The group header doesn't exist."
13411353
)
13421354

1355+
XCTAssertTrue(
1356+
hiddenElementsGroupDescription.exists,
1357+
"The expanded group's description doesn't exist."
1358+
)
1359+
1360+
XCTAssertEqual(
1361+
hiddenElementsGroupDescription.label,
1362+
"The Form Elements in this group need the Radio button \"show invisible form elements\" to be selected, if you want to see them"
1363+
)
1364+
13431365
// Confirm the first element of the conditional group doesn't exist.
13441366
XCTAssertFalse(
13451367
groupElement.exists,

0 commit comments

Comments
 (0)