-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default Payment Method Label (#9845)
- Loading branch information
1 parent
c794da1
commit a41b5d9
Showing
15 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.stripe.android.paymentsheet.ui | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.stripe.android.paymentsheet.R | ||
import com.stripe.android.uicore.DefaultStripeTheme | ||
import com.stripe.android.uicore.stripeColors | ||
|
||
@Composable | ||
internal fun DefaultPaymentMethodLabel( | ||
modifier: Modifier, | ||
) { | ||
Text( | ||
modifier = modifier | ||
.testTag( | ||
TEST_TAG_DEFAULT_PAYMENT_METHOD_LABEL | ||
), | ||
text = stringResource(id = R.string.stripe_wallet_default), | ||
style = MaterialTheme.typography.caption.copy(fontWeight = FontWeight.Medium), | ||
color = MaterialTheme.stripeColors.placeholderText, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis, | ||
) | ||
} | ||
|
||
@Composable | ||
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) | ||
@Preview | ||
private fun DefaultPaymentMethodLabelPreview() { | ||
DefaultStripeTheme { | ||
Row( | ||
modifier = Modifier.background(color = MaterialTheme.stripeColors.component) | ||
) { | ||
DefaultPaymentMethodLabel( | ||
modifier = Modifier | ||
) | ||
} | ||
} | ||
} | ||
|
||
internal const val TEST_TAG_DEFAULT_PAYMENT_METHOD_LABEL = "default_payment_method_label" |
31 changes: 31 additions & 0 deletions
31
...c/test/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabelScreenshotTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.stripe.android.paymentsheet.ui | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.stripe.android.screenshottesting.FontSize | ||
import com.stripe.android.screenshottesting.PaparazziRule | ||
import com.stripe.android.screenshottesting.SystemAppearance | ||
import com.stripe.android.utils.screenshots.PaymentSheetAppearance | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
internal class DefaultPaymentMethodLabelScreenshotTest { | ||
|
||
@get:Rule | ||
val paparazziRule = PaparazziRule( | ||
SystemAppearance.entries, | ||
PaymentSheetAppearance.entries, | ||
FontSize.entries, | ||
) | ||
|
||
@Test | ||
fun testDefaultPaymentMethodLabel() { | ||
paparazziRule.snapshot { | ||
DefaultPaymentMethodLabel( | ||
modifier = Modifier | ||
.padding(horizontal = 4.dp, vertical = 4.dp) | ||
) | ||
} | ||
} | ||
} |
Binary file added
BIN
+1.81 KB
...otTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.68 KB
...shotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.69 KB
...tTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.77 KB
...hotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.46 KB
...Test_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.15 KB
...otTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.81 KB
...tTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.68 KB
...hotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.09 KB
...Test_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.24 KB
...otTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...est_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,DefaultFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.45 KB
...tTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.