Closed cjimenezCT closed 4 months ago
Hello,
It should be as simple as also setting a state changer.
Backstack backstack = new Backstack();
backstack.setup(History.of(first));
backstack.setStateChanger(new StateChanger() {
@Override
public void handleStateChange(@Nonnull StateChange stateChange, @Nonnull Callback completionCallback) {
completionCallback.stateChangeComplete();
}
});
or
backstack.setStateChanger { _, completionCallback -> completionCallback.stateChangeComplete() }
Thank you, this worked but with the addition of setScopedServices
:
val backstack = Backstack()
backstack.setup(History.of(DashboardKey()))
backstack.setScopedServices(DefaultServiceProvider())
backstack.setStateChanger { _, completionCallback -> completionCallback.stateChangeComplete() }
Ah yes, that's correct, as scoped services is technically a separate, configurable add-on.
But yes, that'll work correctly. 👍
I'm trying to setup navigation unit testing for my Compose project but I'm getting stuck on actually getting the backstack to progress past enqueueing the state change. Is there something missing in my setup? Should this instead be done as an instrumented test?
Test
View model
LoginKey