Skip to content

Commit

Permalink
minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pmartinbTEF committed Nov 14, 2023
1 parent b3c6b88 commit 7054585
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.telefonica.mistica.compose.theme.brand.MovistarBrand
import com.telefonica.mistica.compose.theme.brand.VivoBrand
import com.telefonica.mistica.testutils.ScreenshotsTest
import com.telefonica.mistica.testutils.TestUtils.getAllBrands
import com.telefonica.mistica.testutils.TestUtils.getAllButtonStyles
import com.telefonica.mistica.testutils.TestUtils.isInverse
import com.telefonica.mistica.util.getThemeColor
import org.junit.Rule
Expand Down Expand Up @@ -83,7 +82,7 @@ internal class ButtonTest(
@ParameterizedRobolectricTestRunner.Parameters(name = "ButtonXML {1} {0} icon={2}")
fun brands(): List<Array<Any>> {
val allBrands = getAllBrands()
val buttonStyles = getAllButtonStyles()
val buttonStyles = ButtonStyle.values().toList()
val icons = listOf(false, true)
return allBrands.flatMap { brand ->
buttonStyles.flatMap { buttonStyle ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal class ButtonKtTest(private val brand: Brand, private val style: ButtonS
}

private fun `then screenshot is OK`(brand: Brand, style: ButtonStyle, icon: Boolean, darkTheme: Boolean) {
val iconSuffix = if(icon) {
val iconSuffix = if (icon) {
"icon"
} else {
null
Expand All @@ -67,7 +67,7 @@ internal class ButtonKtTest(private val brand: Brand, private val style: ButtonS
@ParameterizedRobolectricTestRunner.Parameters(name = "Button {1} {0} icon={2} darkTheme={3}")
fun brands(): List<Array<Any>> {
val allBrands = TestUtils.getAllBrands()
val buttonStyles = TestUtils.getAllButtonStyles()
val buttonStyles = ButtonStyle.values().toList()
val icons = listOf(false, true)
val darkTheme = listOf(false, true)
return allBrands.flatMap { brand ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object ScreenshotUtils {
"dark".takeIf { darkTheme }
).joinToString(separator = "_")

return """screenshots/$nonNullParams""".plus(".png").replace("\\s+".toRegex(), "")
return "screenshots/$nonNullParams.png".replace("\\s+".toRegex(), "")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ object TestUtils {
TelefonicaBrand,
)

fun getAllButtonStyles() = listOf(
ButtonStyle.PRIMARY, ButtonStyle.PRIMARY_SMALL, ButtonStyle.SECONDARY, ButtonStyle.SECONDARY_SMALL, ButtonStyle.DANGER,
ButtonStyle.DANGER_SMALL, ButtonStyle.LINK, ButtonStyle.PRIMARY_INVERSE, ButtonStyle.PRIMARY_SMALL_INVERSE, ButtonStyle.SECONDARY_INVERSE,
ButtonStyle.SECONDARY_SMALL_INVERSE, ButtonStyle.LINK_INVERSE
)

fun ButtonStyle.isInverse() = when(this) {
ButtonStyle.PRIMARY_INVERSE,
ButtonStyle.PRIMARY_SMALL_INVERSE,
Expand Down

0 comments on commit 7054585

Please sign in to comment.