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:
Benoit Marty
2026-09-29 20:54:27 +02:00
parent f52242ebdd
commit 5f317aa2a0
@@ -162,7 +162,9 @@ class MarkdownTextInputTest : RobolectricTest() {
val state = aMarkdownTextEditorState(initialText = "Test", initialFocus = false)
setMarkdownTextInput(state = state)
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
assertThat(state.hasFocus).isTrue()
}