Skip to content

Commit

Permalink
Merge branch 'develop' into mahi/component/TUICardHeader
Browse files Browse the repository at this point in the history
# Conflicts:
#	tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/TUIRadioButtonRowTest.kt
  • Loading branch information
androidmahi committed Sep 9, 2023
2 parents f6248c6 + 1febe39 commit 26aea5b
Show file tree
Hide file tree
Showing 299 changed files with 1,418 additions and 68 deletions.
2 changes: 1 addition & 1 deletion tarkaui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ publishing {
run {
groupId = "com.tarkalabs"
artifactId = getLibraryArtifactId()
version = "0.39-alpha"
version = "0.40-alpha"
artifact("$buildDir/outputs/aar/${getLibraryArtifactId()}-release.aar")
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.tarkalabs.uicomponents

import androidx.compose.ui.test.assertContentDescriptionContains
import androidx.compose.ui.test.assertTextEquals
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import com.tarkalabs.tarkaicons.ChevronRight24
import com.tarkalabs.tarkaicons.Person24
import com.tarkalabs.uicomponents.components.TUISelectionCard
import com.tarkalabs.uicomponents.components.TUISelectionCardTags
import com.tarkalabs.tarkaicons.TarkaIcons
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify

class TUISelectionCardTest {

@get:Rule val composeRule = createComposeRule()

@Test
fun isPassedThingsInShownInUI() {

val label = "LabelTest"
val desc = "DescTest"
val desc2 = "Desc2Test"
val detail = "Detail1Test"
val detail2 = "Detail2Test"
val badgeCount = 5

val leadingIcon = TarkaIcons.Regular.Person24

//This is default icon when
// isTrailingBackArrowEnabled = true
val trailingIcon = TarkaIcons.Regular.ChevronRight24

val tags = TUISelectionCardTags()

composeRule.setContent {
TUISelectionCard(
label = label,
primaryDescription = desc,
secondaryDescription = desc2,
primaryDetails = detail,
secondaryDetails = detail2,
badgeCount = badgeCount,
leadingIcon = leadingIcon,
showTrailingIcon = true,
tags = tags,
) {

}
}

//if we used multiple similar types of composable or Nodes inside a compose function. jetpack will merge all those into one for performance improvements.
// but we need to find the exact unmerged node (composable) to test. so that's why passed useUnmergedTree = true while finding a node.

// All are Text Composable
composeRule.onNodeWithTag(tags.labelTag, useUnmergedTree = true).assertTextEquals(label)
composeRule.onNodeWithTag(tags.descriptionTag, useUnmergedTree = true).assertTextEquals(desc)
composeRule.onNodeWithTag(tags.description2Tag, useUnmergedTree = true).assertTextEquals(desc2)
composeRule.onNodeWithTag(tags.detailsTag, useUnmergedTree = true).assertTextEquals(detail)
composeRule.onNodeWithTag(tags.details2Tag, useUnmergedTree = true).assertTextEquals(detail2)

//All are Icon Composable
composeRule.onNodeWithTag(tags.leadingIconTag, useUnmergedTree = true)
.assertContentDescriptionContains(leadingIcon.contentDescription)
composeRule.onNodeWithTag(tags.trailingFrontArrowIconTag, useUnmergedTree = true)
.assertContentDescriptionContains(trailingIcon.contentDescription)
}

@Test
fun isOnclickInvoked() {

val onCLickLambda: () -> Unit = mock()

val parentTestTag = "TestParentTag"

composeRule.setContent {
TUISelectionCard(
label = "",
primaryDescription = "",
onCardClicked = onCLickLambda,
tags = TUISelectionCardTags().copy(parentTag = parentTestTag)
)
}

composeRule.onNodeWithTag(parentTestTag).performClick()

verify(onCLickLambda).invoke()
}
}
Loading

0 comments on commit 26aea5b

Please sign in to comment.