mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
address review: replay one dismissal so a recreated screen still sees it
A notification tap can fire the dismissal before the route's collector subscribes (activity recreated with a restored options sheet), and a replay-zero broadcast drops it. Replaying one is a no-op on default state and the new ContextMenuHost test guards it.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.subtracks.ui.components
|
||||
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class ContextMenuHostTest {
|
||||
@Test
|
||||
fun aDismissalBeforeCollectionIsStillDelivered() =
|
||||
runTest {
|
||||
val host = ContextMenuHost()
|
||||
|
||||
host.dismissTransients()
|
||||
|
||||
assertEquals(Unit, withTimeoutOrNull(1_000) { host.dismissals.first() })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user