Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep the composed message when replying [WPB-982] #2969

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class MessageComposerStateHolder(
}

fun toReply(message: UIMessage.Regular) {
messageCompositionHolder.clearMessage()
messageCompositionHolder.setReply(message)
messageCompositionInputStateHolder.toComposing()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ class MessageComposerStateHolderTest {
runTest {
// given
// when
state.toReply(
message = mockMessageWithText
)
state.toReply(mockMessageWithText)

// then
assertEquals(
Expand All @@ -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
Expand Down
Loading