Skip to content

Commit

Permalink
chore(radiobuttons): add paparazzi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FDELAHA24 authored and GerardPaligot committed Mar 9, 2023
1 parent 72ca638 commit 30a5634
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions radiobuttons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ plugins {
id("kotlin-android")
id("VitaminComposeLibraryPlugin")
id("com.vanniktech.maven.publish")
id("app.cash.paparazzi")
}

dependencies {
api(project(":foundation:foundation"))
implementation(AndroidX.compose.ui.tooling)
testImplementation("com.google.testparameterinjector:test-parameter-injector:1.8")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.decathlon.vitamin.radiobuttons

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.cash.paparazzi.Paparazzi
import com.decathlon.vitamin.compose.foundation.VitaminTheme
import com.decathlon.vitamin.compose.radiobuttons.VitaminRadioButtons
import com.decathlon.vitamin.radiobuttons.utils.Theme
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(TestParameterInjector::class)
class VitaminRadioButtonsPrimaryTest {
@get:Rule
val paparazzi = Paparazzi()

@Test
fun medium(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = "Primary", style = VitaminTheme.typography.subtitle1)
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
VitaminRadioButtons.Primary(
selected = true,
enabled = true,
onClick = {})
VitaminRadioButtons.Primary(
selected = false,
enabled = true,
onClick = {})
}
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
VitaminRadioButtons.Primary(
selected = true,
enabled = false,
onClick = {})
VitaminRadioButtons.Primary(
selected = false,
enabled = false,
onClick = {})
}
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
VitaminRadioButtons.Primary(selected = true, enabled = false,
endContent = {
Text(text = "RadioBox", style = VitaminTheme.typography.text1)
}, onClick = {})
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.decathlon.vitamin.radiobuttons.utils

enum class Theme { Light, Dark }
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.

0 comments on commit 30a5634

Please sign in to comment.