Skip to content

Commit

Permalink
Merge pull request #126 from tarkalabs/mahi/test_case_fix
Browse files Browse the repository at this point in the history
Minor Changes done in TUITabBarTest
  • Loading branch information
rajajawahar authored Sep 22, 2023
2 parents 63d4618 + 5c1cd24 commit e7137f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.tarkalabs.tarkaicons.Tabs24
import com.tarkalabs.tarkaicons.TarkaIcons
import com.tarkalabs.uicomponents.components.TUITabBar
import com.tarkalabs.uicomponents.components.TUITabBarTags
import com.tarkalabs.uicomponents.components.TUITabTags
import com.tarkalabs.uicomponents.components.TabItem
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -44,9 +43,9 @@ class TUITabBarTest {
)
}

composeTestRule.onNodeWithTag("Tab 1 ${TUITabTags().parentTag}").assertIsDisplayed()
composeTestRule.onNodeWithTag("Tab 2 ${TUITabTags().parentTag}").assertIsDisplayed()
composeTestRule.onNodeWithTag("Tab 2 ${TUITabTags().parentTag}").assertIsDisplayed()
composeTestRule.onNodeWithTag(tabItems[0].name).assertIsDisplayed()
composeTestRule.onNodeWithTag(tabItems[1].name).assertIsDisplayed()
composeTestRule.onNodeWithTag(tabItems[2].name).assertIsDisplayed()
}

@Test
Expand Down Expand Up @@ -114,10 +113,10 @@ class TUITabBarTest {
}

//Third tab should be shown due to the selected index 2
composeTestRule.onNodeWithTag("Tab 3 ${TUITabTags().parentTag}").assertIsSelected()
composeTestRule.onNodeWithTag(tabItems[2].name, useUnmergedTree = true).assertIsSelected()
//other tabs should not be shown
composeTestRule.onNodeWithTag("Tab 1 ${TUITabTags().parentTag}").assertIsNotSelected()
composeTestRule.onNodeWithTag("Tab 2 ${TUITabTags().parentTag}").assertIsNotSelected()
composeTestRule.onNodeWithTag(tabItems[0].name, useUnmergedTree = true).assertIsNotSelected()
composeTestRule.onNodeWithTag(tabItems[1].name, useUnmergedTree = true).assertIsNotSelected()
}

@Test
Expand All @@ -141,11 +140,11 @@ class TUITabBarTest {
}

var clickedTabIndex = 1
composeTestRule.onNodeWithTag("Tab 2 ${TUITabTags().parentTag}").performClick()
composeTestRule.onNodeWithTag(tabItems[1].name).performClick()
verify(onTabChange).invoke(clickedTabIndex)

clickedTabIndex = 2
composeTestRule.onNodeWithTag("Tab 3 ${TUITabTags().parentTag}").performClick()
composeTestRule.onNodeWithTag(tabItems[2].name).performClick()
verify(onTabChange).invoke(clickedTabIndex)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class TUITabTest {
composeTestRule.setContent {
TUITab(title = "test", tags = testTags, onTabClicked = onClickLambda)
}
composeTestRule.onNodeWithTag(testTags.parentTag).performClick()
//Tab title is the parent tag for TUITab
composeTestRule.onNodeWithTag("test").performClick()
verify(onClickLambda).invoke()
}
}

0 comments on commit e7137f1

Please sign in to comment.