diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/state/MessageComposerStateHolder.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/state/MessageComposerStateHolder.kt index f8e2eeb2ca0..43aed787412 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/state/MessageComposerStateHolder.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/state/MessageComposerStateHolder.kt @@ -109,7 +109,6 @@ class MessageComposerStateHolder( } fun toReply(message: UIMessage.Regular) { - messageCompositionHolder.clearMessage() messageCompositionHolder.setReply(message) messageCompositionInputStateHolder.toComposing() } diff --git a/app/src/test/kotlin/com/wire/android/ui/home/messagecomposer/MessageComposerStateHolderTest.kt b/app/src/test/kotlin/com/wire/android/ui/home/messagecomposer/MessageComposerStateHolderTest.kt index 3ef7e594b63..1717c275ba1 100644 --- a/app/src/test/kotlin/com/wire/android/ui/home/messagecomposer/MessageComposerStateHolderTest.kt +++ b/app/src/test/kotlin/com/wire/android/ui/home/messagecomposer/MessageComposerStateHolderTest.kt @@ -116,9 +116,7 @@ class MessageComposerStateHolderTest { runTest { // given // when - state.toReply( - message = mockMessageWithText - ) + state.toReply(mockMessageWithText) // then assertEquals( @@ -133,6 +131,22 @@ class MessageComposerStateHolderTest { ) } + @Test + fun `given some message was being composed, when setting toReply, then input continues with the current text`() = runTest { + // given + val currentTextField = TextFieldValue("Potato") + messageCompositionHolder.setMessageText(currentTextField, {}, {}, {}) + + // when + state.toReply(mockMessageWithText) + + // then + assertEquals( + currentTextField.text, + messageCompositionHolder.messageComposition.value.messageTextFieldValue.text + ) + } + @Test fun `given state, when input focus change to false, then clear focus`() = runTest { // given