https://kotlinlang.org logo
Title
g

goku

05/10/2022, 9:05 PM
Is there a way to test
Modifier.padding
?
I’m looking for a way to test this conditional but I couldn’t find a way to do this.
modifier = Modifier
           .testTag("header")
           .then(
               if (hasTitle) {
                   Modifier.padding(bottom = dimensionResource(...))
               } else {
                   Modifier
               }
             )
m

MR3Y

05/10/2022, 9:36 PM
AFAIK there is no built-in matcher for this, so, you need to create a custom semantic property for the padding like this: https://developer.android.com/jetpack/compose/testing#custom-semantics-properties
g

goku

05/11/2022, 1:11 AM
Thank you! That’s what I was looking at