diff --git a/Forji/Forji/Views/MetadataPickers.swift b/Forji/Forji/Views/MetadataPickers.swift index 56e1d3e..d341774 100644 --- a/Forji/Forji/Views/MetadataPickers.swift +++ b/Forji/Forji/Views/MetadataPickers.swift @@ -21,9 +21,14 @@ struct DescriptionEditorSection: View { MarkdownPreview(text: text) .font(.subheadline) .lineLimit(3) + // The preview renders selectable text and tappable links. Inside a + // Button label those intercept the tap, so the editor sheet never + // opens. Disable hit testing so the tap falls through to the Button. + .allowsHitTesting(false) } } .tint(.primary) + .accessibilityIdentifier("description-edit-button") .sheet(isPresented: $showingEditor) { DescriptionEditorSheet(text: $text, title: title, onUploadImage: onUploadImage) } diff --git a/Forji/ForjiUITests/IssueMutatingUITests.swift b/Forji/ForjiUITests/IssueMutatingUITests.swift index 84f8ecc..2585aee 100644 --- a/Forji/ForjiUITests/IssueMutatingUITests.swift +++ b/Forji/ForjiUITests/IssueMutatingUITests.swift @@ -67,11 +67,36 @@ final class IssueMutatingUITests: ForgejoUITestBase { editTitleField.tap(withNumberOfTaps: 3, numberOfTouches: 1) editTitleField.typeText("Edited issue title") + // Edit the description. Tapping the description row must open the editor + // sheet, the regression from issue #80 was that the selectable markdown + // preview swallowed the tap so the sheet never appeared. + let descriptionButton = app.buttons["description-edit-button"] + XCTAssertTrue(descriptionButton.waitForExistence(timeout: 5)) + descriptionButton.tap() + + let descriptionEditor = app.textViews["markdown-text-editor"] + XCTAssertTrue( + descriptionEditor.waitForExistence(timeout: 5), + "Tapping the description should open the editor sheet", + ) + descriptionEditor.tap() + descriptionEditor.typeText("UITESTDESC ") + app.buttons["Done"].tap() + let saveButton = app.buttons["issue-edit-save"] XCTAssertTrue(saveButton.waitForExistence(timeout: 5)) saveButton.tap() XCTAssertTrue(app.staticTexts["Edited issue title"].waitForExistence(timeout: 10)) + // The edited description must be persisted and rendered in the detail view. + let editedDescription = app.staticTexts.element( + matching: NSPredicate(format: "label CONTAINS %@", "UITESTDESC"), + ) + XCTAssertTrue( + editedDescription.waitForExistence(timeout: 10), + "Edited description should appear in the issue detail", + ) + // Close and reopen expandActionMenu() let toggleButton = app.buttons["issue-toggle-state"]