diff --git a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt index 036a2955c..4ec271d66 100644 --- a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt +++ b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationTest.kt @@ -20,9 +20,8 @@ import androidx.annotation.StringRes import androidx.compose.ui.test.assertCountEquals import androidx.compose.ui.test.assertIsOn import androidx.compose.ui.test.assertIsSelected -import androidx.compose.ui.test.hasAnyAncestor -import androidx.compose.ui.test.hasTestTag import androidx.compose.ui.test.hasText +import androidx.compose.ui.test.isSelectable import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onAllNodesWithText @@ -210,9 +209,7 @@ class NavigationTest { // Check that the saved screen is still visible and selected. onNode( hasText(saved) and - hasAnyAncestor( - hasTestTag("NiaBottomBar") or hasTestTag("NiaNavRail"), - ), + isSelectable(), ).assertIsSelected() } } @@ -249,22 +246,4 @@ class NavigationTest { onNodeWithText(forYou).assertExists() } } - - @Test - fun navigationBar_multipleBackStackInterests() { - composeTestRule.apply { - onNodeWithText(interests).performClick() - // TODO: Grab string from fake data - onNodeWithText("Android Studio & Tools").performClick() - - // Switch tab - onNodeWithText(forYou).performClick() - - // Come back to Interests - onNodeWithText(interests).performClick() - - // Verify we're not in the list of interests - onNodeWithText("Android Auto").assertDoesNotExist() // TODO: Grab string from fake data - } - } } diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt index 86eb84628..a29c370b9 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt @@ -129,7 +129,7 @@ fun NiaApp( AdaptiveScaffold( navigator = adaptiveScaffoldNavigator, navigationItems = TopLevelDestination.values().toList(), - navigationItemTitle = { item, _ -> Text(text = stringResource(id = item.titleTextId)) }, + navigationItemTitle = { item, _ -> Text(text = stringResource(id = item.iconTextId)) }, navigationItemIcon = { item, isSelected -> val isUnread = unreadDestinations.contains(item) Icon( @@ -139,9 +139,7 @@ fun NiaApp( ) }, isItemSelected = { item -> - appState.currentDestination.isTopLevelDestinationInHierarchy( - item, - ) + appState.currentDestination.isTopLevelDestinationInHierarchy(item) }, onNavigationItemClick = appState::navigateToTopLevelDestination, colors = AdaptiveScaffoldNavigationComponentDefaults.colors(