Skip to content

Commit

Permalink
Modify SavedPaymentMethodTab click group to match the accessibility r…
Browse files Browse the repository at this point in the history
…equirements
  • Loading branch information
cttsai-stripe committed Jan 8, 2025
1 parent 8a503d4 commit 309f802
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ internal val SavedPaymentMethodsTopContentPadding = 12.dp

@Composable
internal fun SavedPaymentMethodTab(
modifier: Modifier = Modifier,
viewWidth: Dp,
isSelected: Boolean,
shouldShowModifyBadge: Boolean,
isEnabled: Boolean,
isClickable: Boolean = isEnabled,
iconRes: Int,
modifier: Modifier = Modifier,
iconTint: Color? = null,
@DrawableRes labelIcon: Int? = null,
labelText: String = "",
Expand All @@ -84,14 +84,19 @@ internal fun SavedPaymentMethodTab(
)
},
content = {
Column {
Column(
modifier = Modifier
.testTag("${SAVED_PAYMENT_METHOD_CARD_TEST_TAG}_$labelText")
.selectable(
selected = isSelected,
enabled = isClickable,
onClick = onItemSelectedListener,
),
) {
SavedPaymentMethodCard(
isSelected = isSelected,
isClickable = isClickable,
labelText = labelText,
iconRes = iconRes,
iconTint = iconTint,
onItemSelectedListener = onItemSelectedListener,
)

LpmSelectorText(
Expand Down Expand Up @@ -137,11 +142,8 @@ private fun SavedPaymentMethodBadge(
@Composable
private fun SavedPaymentMethodCard(
isSelected: Boolean,
isClickable: Boolean,
iconRes: Int,
iconTint: Color?,
labelText: String,
onItemSelectedListener: (() -> Unit),
modifier: Modifier = Modifier,
) {
SectionCard(
Expand All @@ -156,12 +158,6 @@ private fun SavedPaymentMethodCard(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxSize()
.testTag("${SAVED_PAYMENT_METHOD_CARD_TEST_TAG}_$labelText")
.selectable(
selected = isSelected,
enabled = isClickable,
onClick = onItemSelectedListener,
),
) {
Image(
painter = painterResource(iconRes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.os.Build
import androidx.compose.ui.test.assertContentDescriptionEquals
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onParent
import androidx.compose.ui.unit.dp
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.stripe.android.paymentsheet.R
Expand Down Expand Up @@ -39,7 +38,6 @@ class PaymentOptionTest {

composeTestRule
.onNodeWithText(label)
.onParent()
.assertContentDescriptionEquals("Card ending in 4 2 4 2 ")
}
}

0 comments on commit 309f802

Please sign in to comment.