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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user