mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
The description row in DescriptionEditorSection is a Button whose label renders a MarkdownPreview when a body exists. The preview enables text selection and tappable links, which intercepted the tap inside the Button label so the editor sheet never opened. Existing issues (with a body) could therefore not have their description edited; only the empty 'None' placeholder was tappable. Disable hit testing on the preview so the tap falls through to the Button. This fixes IssueEditView, PullRequestEditView, and the create flows, which all share DescriptionEditorSection. Extend IssueMutatingUITests to edit an issue description and verify it persists, closing the coverage gap (the prior test only edited the title). Closes #80 Reviewed-on: https://codeberg.org/secana/Forji/pulls/81
This commit is contained in:
parent
69f7923a52
commit
64145f50cc
2 changed files with 30 additions and 0 deletions
|
|
@ -21,9 +21,14 @@ struct DescriptionEditorSection: View {
|
||||||
MarkdownPreview(text: text)
|
MarkdownPreview(text: text)
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.lineLimit(3)
|
.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)
|
.tint(.primary)
|
||||||
|
.accessibilityIdentifier("description-edit-button")
|
||||||
.sheet(isPresented: $showingEditor) {
|
.sheet(isPresented: $showingEditor) {
|
||||||
DescriptionEditorSheet(text: $text, title: title, onUploadImage: onUploadImage)
|
DescriptionEditorSheet(text: $text, title: title, onUploadImage: onUploadImage)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,36 @@ final class IssueMutatingUITests: ForgejoUITestBase {
|
||||||
editTitleField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
|
editTitleField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
|
||||||
editTitleField.typeText("Edited issue title")
|
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"]
|
let saveButton = app.buttons["issue-edit-save"]
|
||||||
XCTAssertTrue(saveButton.waitForExistence(timeout: 5))
|
XCTAssertTrue(saveButton.waitForExistence(timeout: 5))
|
||||||
saveButton.tap()
|
saveButton.tap()
|
||||||
XCTAssertTrue(app.staticTexts["Edited issue title"].waitForExistence(timeout: 10))
|
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
|
// Close and reopen
|
||||||
expandActionMenu()
|
expandActionMenu()
|
||||||
let toggleButton = app.buttons["issue-toggle-state"]
|
let toggleButton = app.buttons["issue-toggle-state"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue