Skip to content

Commit

Permalink
Merge pull request #172 from tarkalabs/sheshu/feature/tui_mobile_over…
Browse files Browse the repository at this point in the history
…lay_menu

Tui menu item renamed to tui MobileOverlayMenu item
  • Loading branch information
rajajawahar authored Jan 23, 2024
2 parents 51020c7 + daa0d2d commit 39de0c2
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import com.tarkalabs.tarkaicons.AddCircle24
import com.tarkalabs.tarkaicons.TarkaIcons
import com.tarkalabs.uicomponents.components.MenuItemLeadingContentType.StatusIndicator
import com.tarkalabs.uicomponents.components.MenuItemStyle.Title
import com.tarkalabs.uicomponents.components.MenuItemStyle.TitleWithDescription
import com.tarkalabs.uicomponents.components.MenuItemTrailingContentType.Icon
import com.tarkalabs.uicomponents.components.TUIMenuItem
import com.tarkalabs.uicomponents.components.TUIMenuItemTags
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemLeadingContentType.StatusIndicator
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemStyle.Title
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemStyle.TitleWithDescription
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemTrailingContentType.Icon
import com.tarkalabs.uicomponents.components.TUIMobileOverlayMenuItem
import com.tarkalabs.uicomponents.components.TUIMobileOverlayMenuItemTags
import com.tarkalabs.uicomponents.theme.TUITheme
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify

class TUIMenuItemTest {
class TUIMobileOverlayMenuItemTest {

@get:Rule val composeTestRule = createComposeRule()
val tags: TUIMenuItemTags = TUIMenuItemTags()
val tags: TUIMobileOverlayMenuItemTags = TUIMobileOverlayMenuItemTags()

@Test fun menuItem_Displayed() {
@Test fun mobileOverlayMenuItem_Displayed() {
composeTestRule.setContent {
TUIMenuItem(
TUIMobileOverlayMenuItem(
title = "Label",
style = Title,
onMenuItemClick = {},
onMobileOverlayMenuItemClick = {},
isSelected = true,
modifier = Modifier.fillMaxWidth(),
leadingContent = StatusIndicator,
Expand All @@ -47,12 +47,12 @@ class TUIMenuItemTest {
composeTestRule.onNodeWithText("Label",useUnmergedTree = true).assertIsDisplayed()
}

@Test fun menuItem_WithDescription_Displayed() {
@Test fun mobileOverlayMenuItem_WithDescription_Displayed() {
composeTestRule.setContent {
TUIMenuItem(
TUIMobileOverlayMenuItem(
title = "Label",
style = TitleWithDescription("TitleWithDescription"),
onMenuItemClick = {},
onMobileOverlayMenuItemClick = {},
isSelected = true,
modifier = Modifier.fillMaxWidth(),
tags = tags
Expand All @@ -67,10 +67,10 @@ class TUIMenuItemTest {
val onMenuItemClick: () -> Unit = mock()

composeTestRule.setContent {
TUIMenuItem(
TUIMobileOverlayMenuItem(
title = "Label",
style = Title,
onMenuItemClick = onMenuItemClick,
onMobileOverlayMenuItemClick = onMenuItemClick,
isSelected = true,
modifier = Modifier.fillMaxWidth(),
leadingContent = StatusIndicator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ package com.tarkalabs.uicomponents.screenshots

import com.tarkalabs.tarkaicons.AddCircle24
import com.tarkalabs.tarkaicons.TarkaIcons
import com.tarkalabs.uicomponents.components.MenuItemLeadingContentType
import com.tarkalabs.uicomponents.components.MenuItemLeadingContentType.Icon
import com.tarkalabs.uicomponents.components.MenuItemLeadingContentType.StatusIndicator
import com.tarkalabs.uicomponents.components.MenuItemStyle
import com.tarkalabs.uicomponents.components.MenuItemStyle.Title
import com.tarkalabs.uicomponents.components.MenuItemStyle.TitleWithDescription
import com.tarkalabs.uicomponents.components.MenuItemTrailingContentType
import com.tarkalabs.uicomponents.components.MenuItemTrailingContentType.SubMenu
import com.tarkalabs.uicomponents.components.TUIMenuItem
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemLeadingContentType
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemLeadingContentType.Icon
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemLeadingContentType.StatusIndicator
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemStyle
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemStyle.Title
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemStyle.TitleWithDescription
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemTrailingContentType
import com.tarkalabs.uicomponents.components.MobileOverlayMenuItemTrailingContentType.SubMobileOverlayMenu
import com.tarkalabs.uicomponents.components.TUIMobileOverlayMenuItem
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
class TUIMenuItemScreenshotTest(
private val style: MenuItemStyle,
private val leadingContentType: MenuItemLeadingContentType?,
private val trailingContentType: MenuItemTrailingContentType?,
class TUIMobileOverlayMenuItemScreenshotTest(
private val style: MobileOverlayMenuItemStyle,
private val leadingContentType: MobileOverlayMenuItemLeadingContentType?,
private val trailingContentType: MobileOverlayMenuItemTrailingContentType?,
private val isSelected: Boolean,
private val darkTheme: Boolean,
private val testName: String
Expand All @@ -39,8 +39,8 @@ class TUIMenuItemScreenshotTest(
)
val trailingContentTypes = listOf(
null,
MenuItemTrailingContentType.Icon(TarkaIcons.Regular.AddCircle24),
SubMenu
MobileOverlayMenuItemTrailingContentType.Icon(TarkaIcons.Regular.AddCircle24),
SubMobileOverlayMenu
)
val isSelectedValues = listOf(true, false)
val darkThemeValues = listOf(true, false)
Expand Down Expand Up @@ -69,40 +69,40 @@ class TUIMenuItemScreenshotTest(
return testData
}

private fun getSimpleName(menuItemStyle: MenuItemStyle): String {
return when(menuItemStyle){
private fun getSimpleName(mobileOverlayMenuItemStyle: MobileOverlayMenuItemStyle): String {
return when(mobileOverlayMenuItemStyle){
Title -> "Title"
is TitleWithDescription -> "TitleWithDescription"
}
}

private fun getSimpleName(type: MenuItemLeadingContentType?): String {
private fun getSimpleName(type: MobileOverlayMenuItemLeadingContentType?): String {
return when(type){
is Icon -> "Icon"
StatusIndicator -> "StatusIndicator"
else -> "null"
}
}

private fun getSimpleName(type: MenuItemTrailingContentType?): String {
private fun getSimpleName(type: MobileOverlayMenuItemTrailingContentType?): String {
return when(type){
is MenuItemTrailingContentType.Icon -> "Icon"
SubMenu -> "SubMenu"
is MobileOverlayMenuItemTrailingContentType.Icon -> "Icon"
SubMobileOverlayMenu -> "SubMobileOverlayMenu"
else -> "null"
}
}
}

@Test
fun testTuiMenuItem() {
fun testTuiMobileOverlayMenuItem() {
compareScreenshotFor(darkTheme, testName) {
TUIMenuItem(
TUIMobileOverlayMenuItem(
title = "Label",
isSelected = isSelected,
style = style,
leadingContent = leadingContentType,
trailingContent = trailingContentType,
onMenuItemClick = { /*TODO*/ },
onMobileOverlayMenuItemClick = { /*TODO*/ },
)
}
}
Expand Down
Loading

0 comments on commit 39de0c2

Please sign in to comment.