diff --git a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/FormElements/UtilityAssociationsFormElement/UtilityAssociationAssetTypesView.swift b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/FormElements/UtilityAssociationsFormElement/UtilityAssociationAssetTypesView.swift index 41295c855..6ead996e4 100644 --- a/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/FormElements/UtilityAssociationsFormElement/UtilityAssociationAssetTypesView.swift +++ b/Sources/ArcGISToolkit/Components/FeatureFormView/Subviews/FormElements/UtilityAssociationsFormElement/UtilityAssociationAssetTypesView.swift @@ -31,11 +31,17 @@ extension FeatureFormView { let source: UtilityAssociationFeatureSource /// The filtered asset types that can be used to query for association candidates. + /// + /// Types are sorted first by their name and then by their group name. private var filteredTypes: [UtilityAssetType] { + let result: [UtilityAssetType] if filterPhrase.isEmpty { - source.assetTypes + result = source.assetTypes } else { - source.assetTypes.filter({ $0.name.localizedStandardContains(filterPhrase) }) + result = source.assetTypes.filter({ $0.name.localizedStandardContains(filterPhrase) }) + } + return result.sorted { + ($0.name, $0.group?.name ?? "") < ($1.name, $1.group?.name ?? "") } } @@ -50,7 +56,7 @@ extension FeatureFormView { comment: """ A label for a search field to filter utility asset types by name. - """, + """ ), prompt: nil ) @@ -58,12 +64,21 @@ extension FeatureFormView { Section { ForEach(filteredTypes, id: \.compositeID) { assetType in NavigationLink( - assetType.name, value: FeatureFormView.NavigationPathItem.utilityAssociationFeatureCandidatesView( - form, element, filter, source, assetType + form, element, + filter, + source, assetType ) - ) - .accessibilityIdentifier("Asset Type \(assetType.name) \(assetType.code)") + ) { + VStack(alignment: .leading) { + Text(assetType.name) + if let group = assetType.group { + Text(group.name) + .font(.caption) + .foregroundStyle(.secondary) + } + } + } } } header: { HStack { diff --git a/Test Runner/UI Tests/FeatureFormViewTests.swift b/Test Runner/UI Tests/FeatureFormViewTests.swift index 2a1c2b141..5214c0aa4 100644 --- a/Test Runner/UI Tests/FeatureFormViewTests.swift +++ b/Test Runner/UI Tests/FeatureFormViewTests.swift @@ -1451,7 +1451,7 @@ final class FeatureFormViewTests: XCTestCase { let app = XCUIApplication() let addButton = app.buttons["Add"] let associationTypeLabel = app.staticTexts["Association Type"] - let cabinetFuseButton = app.buttons["Cabinet Fuse"] + let cabinetFuseButton = app.buttons["Cabinet Fuse, Fuse"] let connectedFilterTitle = app.staticTexts["Connected"] let connectivityLabel = app.staticTexts["Connectivity"] let discardButton = app.buttons["Discard"] @@ -1549,7 +1549,7 @@ final class FeatureFormViewTests: XCTestCase { let terminalLabel = app.staticTexts["Terminal"] let terminalPicker = app.buttons["Terminal, High"] let toElementLabel = app.staticTexts["To Element"] - let undergroundMediumVoltageThreePhaseDisconnectButton = app.buttons["Asset Type Underground Medium Voltage Three Phase Disconnect 493"] + let undergroundMediumVoltageThreePhaseDisconnectButton = app.buttons["Underground Medium Voltage Three Phase Disconnect, Switch"] #if targetEnvironment(macCatalyst) let addAssociationButton = app.buttons["Add Association"] @@ -1648,7 +1648,7 @@ final class FeatureFormViewTests: XCTestCase { let structureJunctionDataSourceButton = app.buttons["Structure Junction"] let toElementValueLabel = app.staticTexts["Vault"] let toElementLabel = app.staticTexts["To Element"] - let vaultAssetTypeButton = app.buttons["Vault"] + let vaultAssetTypeButton = app.buttons["Vault, Vault"] let vaultCandidateButton = app.staticTexts.matching(identifier: "Vault").element(boundBy: 1) #if targetEnvironment(macCatalyst) @@ -1722,7 +1722,7 @@ final class FeatureFormViewTests: XCTestCase { let filterButton = app.buttons["Filter Candidates"] let formTitle = app.staticTexts["Electric Distribution Device"] let lineEndCandidates = app.buttons.matching(identifier: "Line End") - let lowVoltageSinglePhaseLineEnd = app.buttons["Low Voltage Single Phase Line End"] + let lowVoltageSinglePhaseLineEnd = app.buttons["Low Voltage Single Phase Line End, Line End"] let valueButton = app.buttons["Value"] #if os(visionOS) || targetEnvironment(macCatalyst) @@ -1857,7 +1857,7 @@ final class FeatureFormViewTests: XCTestCase { let greaterThanLabels = app.staticTexts.matching(identifier: ">") let jan2014Label = app.staticTexts["January 2014"] let lessThanButton = app.buttons["<"] - let municipalButton = app.buttons["Municipal"] + let municipalButton = app.buttons["Municipal, Street Light"] let streetLightCandidates = app.buttons.matching(identifier: "Street Light") #if os(visionOS) || targetEnvironment(macCatalyst) @@ -1972,7 +1972,7 @@ final class FeatureFormViewTests: XCTestCase { let textField = app.textFields["Enter a value"] let filterButton = app.buttons["Filter Candidates"] let formTitle = app.staticTexts["Structure Junction"] - let municipalButton = app.buttons["Municipal"] + let municipalButton = app.buttons["Municipal, Street Light"] let streetLightButton = app.buttons["Street Light"] let streetLightCandidates = app.buttons.matching(identifier: "Street Light")