mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix MarkdownTextInputTest with Compose 1.13
The Compose 1.13 test libraries start the test window in touch mode, where the editor is not focusable in Robolectric, so `requestFocus()` was not giving it the focus anymore. Use `requestFocusFromTouch()`, which leaves the touch mode first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -162,7 +162,9 @@ class MarkdownTextInputTest : RobolectricTest() {
|
|||||||
val state = aMarkdownTextEditorState(initialText = "Test", initialFocus = false)
|
val state = aMarkdownTextEditorState(initialText = "Test", initialFocus = false)
|
||||||
setMarkdownTextInput(state = state)
|
setMarkdownTextInput(state = state)
|
||||||
val editor = activity!!.findEditor()
|
val editor = activity!!.findEditor()
|
||||||
editor.requestFocus()
|
// The test window is in touch mode, where the editor is not focusable in Robolectric.
|
||||||
|
// requestFocusFromTouch() leaves the touch mode first, like a hardware keyboard would do.
|
||||||
|
editor.requestFocusFromTouch()
|
||||||
// Focus state is updated
|
// Focus state is updated
|
||||||
assertThat(state.hasFocus).isTrue()
|
assertThat(state.hasFocus).isTrue()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user