File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
android/libraries/rib-base/src
main/kotlin/com/uber/rib/core
test/kotlin/com/uber/rib/core Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -206,11 +206,11 @@ protected constructor(
206206 public open fun dispatchDetach () {
207207 checkForMainThread()
208208
209- interactorGeneric.dispatchDetach()
210209 willDetach()
211210 for (child in children) {
212211 detachChild(child)
213212 }
213+ interactorGeneric.dispatchDetach()
214214 }
215215
216216 /* *
Original file line number Diff line number Diff line change @@ -97,16 +97,23 @@ class InteractorAndRouterTest {
9797 router.dispatchDetach()
9898
9999 // Then.
100- val ribActionInfoValues = ribActionInfoObserver.values()
101- ribActionInfoValues
102- .last()
103- .assertRibActionInfo(
104- RibEventType .DETACHED ,
105- RibActionEmitterType .ROUTER ,
106- RibActionState .COMPLETED ,
107- " com.uber.rib.core.FakeRouter" ,
108- )
109100 verify(childInteractor).dispatchDetach()
101+ val ribActionInfoValues = ribActionInfoObserver.values()
102+ val childRouterDetachIndex =
103+ ribActionInfoValues.indexOfFirst {
104+ it.ribEventType == RibEventType .DETACHED &&
105+ it.ribActionEmitterType == RibActionEmitterType .ROUTER &&
106+ it.ribActionState == RibActionState .COMPLETED
107+ }
108+ val selfInteractorDetachIndex =
109+ ribActionInfoValues.indexOfFirst {
110+ it.ribEventType == RibEventType .DETACHED &&
111+ it.ribActionEmitterType == RibActionEmitterType .INTERACTOR &&
112+ it.ribActionState == RibActionState .COMPLETED
113+ }
114+ assertThat(selfInteractorDetachIndex).isGreaterThan(- 1 )
115+ assertThat(childRouterDetachIndex).isGreaterThan(- 1 )
116+ assertThat(selfInteractorDetachIndex > childRouterDetachIndex).isTrue()
110117 }
111118
112119 @Test
You can’t perform that action at this time.
0 commit comments