Add accessibility identifiers in SegmentedPicker

This commit is contained in:
Alfonso Grillo
2023-01-13 16:30:16 +01:00
parent e2247ae5a1
commit 098f957a51
2 changed files with 6 additions and 1 deletions
@@ -23,18 +23,22 @@ class PollHistoryUITests: MockScreenTestCase {
let title = app.navigationBars.firstMatch.identifier
let emptyText = app.staticTexts["PollHistory.emptyText"]
let items = app.staticTexts["PollListItem.title"]
let selectedSegment = app.buttons["\(VectorL10n.pollHistoryActiveSegmentTitle)-selected"]
XCTAssertEqual(title, VectorL10n.pollHistoryTitle)
XCTAssertTrue(items.exists)
XCTAssertFalse(emptyText.exists)
XCTAssertTrue(selectedSegment.exists)
}
func testPollHistoryShowsEmptyScreen() {
app.goToScreenWithIdentifier(MockPollHistoryScreenState.activeEmpty.title)
app.goToScreenWithIdentifier(MockPollHistoryScreenState.pastEmpty.title)
let title = app.navigationBars.firstMatch.identifier
let emptyText = app.staticTexts["PollHistory.emptyText"]
let items = app.staticTexts["PollListItem.title"]
let selectedSegment = app.buttons["\(VectorL10n.pollHistoryPastSegmentTitle)-selected"]
XCTAssertEqual(title, VectorL10n.pollHistoryTitle)
XCTAssertFalse(items.exists)
XCTAssertTrue(emptyText.exists)
XCTAssertTrue(selectedSegment.exists)
}
}
@@ -42,6 +42,7 @@ struct SegmentedPicker<Tag: Hashable>: View {
.underline(isSelectedSegment)
}
.accentColor(isSelectedSegment ? theme.colors.accent : theme.colors.primaryContent)
.accessibilityLabel(text + (isSelectedSegment ? "-selected" : ""))
}
}
}