UI test fixes (#2309)

* Fix settings screen screenshots

* Fix user session test snapshots

* Fix poll creation form UI test after moving to textViews instead of textFields

* Add missing room member details snapshot

* Update the home screen avatar snapshot as the badge is not shown anymore

* Dismiss the keyboard on the poll form when inserting a new line on a poll option
This commit is contained in:
Stefan Ceriu
2024-01-08 18:02:29 +02:00
committed by GitHub
parent 8374682111
commit d23ab7b921
35 changed files with 88 additions and 72 deletions

View File

@@ -74,9 +74,16 @@ struct PollFormScreen: View {
}
.focused($focus, equals: .option(index: index))
.accessibilityIdentifier(A11yIdentifiers.pollFormScreen.optionID(index))
.onSubmit {
let nextOptionIndex = index == context.options.endIndex - 1 ? nil : index + 1
focus = nextOptionIndex.map { .option(index: $0) }
.onChange(of: context.options[index].text) { optionText in
guard let lastCharacter = optionText.last, lastCharacter.isNewline else {
return
}
context.options[index].text.removeLast()
submitOption(at: index)
}
.onSubmit { // onSubmit is still called when using the return key on a hardware keyboard
submitOption(at: index)
}
.submitLabel(index == context.options.endIndex - 1 ? .done : .next)
}
@@ -98,6 +105,11 @@ struct PollFormScreen: View {
.animation(.noAnimation, value: UUID())
}
private func submitOption(at index: Array<PollFormScreenViewStateBindings.Option>.Index) {
let nextOptionIndex = index == context.options.endIndex - 1 ? nil : index + 1
focus = nextOptionIndex.map { .option(index: $0) }
}
private var showResultsSection: some View {
Section {
ListRow(label: .plain(title: L10n.screenCreatePollAnonymousDesc),