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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

NT-2095:View Replies show and hide with scrolling #1312

Merged
merged 4 commits into from
Jul 6, 2021
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 @@ -200,8 +200,11 @@ interface CommentsViewHolderViewModel {

comment
.map { it.repliesCount() }
.compose(combineLatestPair(this.isCommentEnableThreads))
.compose(bindToLifecycle())
.subscribe(this.commentRepliesCount)
.subscribe {
this.commentRepliesCount.onNext(it.first)
}

comment
.map { it.author()?.name() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.junit.Test
import rx.Observable
import rx.observers.TestSubscriber
import rx.schedulers.TestScheduler
import rx.subjects.BehaviorSubject
import java.util.concurrent.TimeUnit

class CommentsViewHolderViewModelTest : KSRobolectricTestCase() {
Expand Down Expand Up @@ -285,11 +286,17 @@ class CommentsViewHolderViewModelTest : KSRobolectricTestCase() {

@Test
fun testSetRepliesCount() {
setUpEnvironment(environment())
val repliesCount = BehaviorSubject.create<Int>()

val environment = optimizelyFeatureFlagOn().toBuilder()
.currentUser(MockCurrentUser(UserFactory.user()))
.build()
setUpEnvironment(environment)
val comment = CommentFactory.comment(repliesCount = 1)
val commentData = CommentCardData.builder().comment(comment).project(ProjectFactory.project()).build()
this.vm.outputs.commentRepliesCount().subscribe(repliesCount)
this.vm.inputs.configureWith(commentData)
this.repliesCount.assertValue(comment.repliesCount())
assertEquals(comment.repliesCount(), repliesCount.value)
}

private fun optimizelyFeatureFlagOn() = environment().toBuilder()
Expand Down