Skip to content

Commit

Permalink
Updated PresentationTests for non-legacy present behavior in containers
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-udy committed Sep 12, 2024
1 parent 0ff64ba commit 206ac3d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import dev.enro.core.container.EmptyBehavior
import dev.enro.core.container.NavigationContainerProperty
import dev.enro.core.container.acceptNone
import dev.enro.core.container.accept
import dev.enro.core.container.emptyBackstack
import dev.enro.core.containerManager
import dev.enro.core.controller.NavigationController
Expand Down Expand Up @@ -60,7 +60,7 @@ private class FragmentLifecycleCallbacksForEnro(
FragmentNavigationContainer(
containerId = android.R.id.content,
parentContext = activity.navigationContext,
filter = acceptNone(),
filter = accept { anyPresented() },
emptyBehavior = EmptyBehavior.AllowEmpty,
interceptor = {},
animations = {},
Expand Down
15 changes: 10 additions & 5 deletions enro/src/androidTest/java/dev/enro/test/PresentationTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import dev.enro.core.NavigationKey
import dev.enro.core.R
import dev.enro.core.compose.rememberNavigationContainer
import dev.enro.core.container.EmptyBehavior
import dev.enro.core.container.acceptKey
import dev.enro.core.container.doNotAccept
import dev.enro.core.container.accept
import dev.enro.core.directParentContainer
import dev.enro.core.fragment.container.navigationContainer
import dev.enro.core.getNavigationHandle
Expand Down Expand Up @@ -287,8 +286,11 @@ class ActivityWithFragmentContainer : FragmentActivity() {

val container by navigationContainer(
containerId = containerId,
filter = acceptKey {
it !is PresentationTests.NotSupportedFragmentKey && it !is PresentationTests.NotSupportedComposeKey
filter = accept {
anyPresented()
key {
it !is PresentationTests.NotSupportedFragmentKey && it !is PresentationTests.NotSupportedComposeKey
}
}
)

Expand All @@ -312,7 +314,10 @@ class ActivityWithComposeContainer : FragmentActivity() {
setContent {
val container = rememberNavigationContainer(
emptyBehavior = EmptyBehavior.AllowEmpty,
filter = doNotAccept { key<PresentationTests.NotSupportedComposeKey>() }
filter = accept {
anyPresented()
key { it !is PresentationTests.NotSupportedComposeKey }
}
)
Box(modifier = Modifier.fillMaxSize()) {
container.Render()
Expand Down

0 comments on commit 206ac3d

Please sign in to comment.