Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 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
11 changes: 10 additions & 1 deletion Sources/ArcGISToolkit/Common/AttachmentsFeatureElementView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ struct AttachmentsFeatureElementView: View {
case .success(let models):
if let formElement {
Group {
if !models.isEmpty {
if models.isEmpty {
Text(
"No attachments",
bundle: .toolkitModule,
comment: """
A label indicating an element
contains no file attachments.
"""
)
} else {
Comment on lines +68 to +77
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This prevents the enclosing Group from being optimized out, causing the onAttachmentIsEditableChange modifier on it to never run.

attachmentBody(attachmentModels: models)
}
if isEditable {
Expand Down
4 changes: 4 additions & 0 deletions Sources/ArcGISToolkit/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ data sources in a utility network. */
/* A label indicating that no associations are available for the utility associations element. */
"No Associations" = "No Associations";

/* A label indicating an element
contains no file attachments. */
"No attachments" = "No attachments";

/* A label indicating that no bookmarks are available for selection. */
"No bookmarks" = "No bookmarks";

Expand Down
2 changes: 2 additions & 0 deletions Test Runner/Test Runner/TestViews/FeatureFormTestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private extension FeatureFormTestView {

/// The set of all Form View UI test cases.
var cases: [TestCase] {[
.init("testAttachmentLoadDurability", objectID: 1, portalID: .groupAndAttachments),
.init("testAttachmentRenaming", objectID: 1, portalID: .attachmentMapID),
.init("testCase_1_1", objectID: 1, portalID: .inputValidationMapID),
.init("testCase_1_2", objectID: 1, portalID: .inputValidationMapID),
Expand Down Expand Up @@ -324,6 +325,7 @@ private extension String {
static let attachmentMapID = "3e551c383fc949c7982ec73ba67d409b"
static let comboBoxMapID = "ed930cf0eb724ea49c6bccd8fd3dd9af"
static let dateMapID = "ec09090060664cbda8d814e017337837"
static let groupAndAttachments = "faae5df8d326413a8f187b7046bf70d3"
static let groupElementMapID = "97495f67bd2e442dbbac485232375b07"
static let inputValidationMapID = "5d69e2301ad14ec8a73b568dfc29450a"
static let napervilleElectricUtilityNetwork = "471eb0bf37074b1fbb972b1da70fb310"
Expand Down
16 changes: 16 additions & 0 deletions Test Runner/UI Tests/FeatureFormViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ final class FeatureFormViewTests: XCTestCase {
formViewTestsButton.tap()
}

/// Verify that the attachments form element load isn't cancelled early when it's pushed below the fold
/// by a group element.
func testAttachmentLoadDurability() {
let app = XCUIApplication()
let attachmentLabel = app.staticTexts["esri.jpg"]
let elementTitle = "Attachments"
let formTitle = app.staticTexts["Group and Attachments"]

openTestCase()
assertFormOpened(titleElement: formTitle)

app.filterElements(elementTitle)

attachmentLabel.assertExistence()
}

func testAttachmentRenaming() {
let app = XCUIApplication()
let activityIndicator = app.activityIndicators.firstMatch
Expand Down