-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PaymentMethodEmbeddedLayoutUI #9808
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
5b0276d
to
040dad3
Compare
Will remove rowType from |
...src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVEmbeddedLayoutUI.kt
Outdated
Show resolved
Hide resolved
...src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVEmbeddedLayoutUI.kt
Outdated
Show resolved
Hide resolved
...src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVEmbeddedLayoutUI.kt
Outdated
Show resolved
Hide resolved
.../com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUIScreenshotTest.kt
Outdated
Show resolved
Hide resolved
.../test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUITest.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUI.kt
Outdated
Show resolved
Hide resolved
@@ -47,7 +47,7 @@ class PaymentMethodEmbeddedLayoutUIScreenshotTest { | |||
onSelectSavedPaymentMethod = {}, | |||
onManageOneSavedPaymentMethod = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually thinking a bit about the reverse. I thought all of the fields outside of row style were the same. And row style was the only "difference".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about both? Added TestPaymentMethodLayoutUi
helper function
if (rowStyle.hasSeparators()) { | ||
val color = Color(rowStyle.separatorColor()) | ||
val thickness = rowStyle.separatorThickness() | ||
val modifier = if (rowStyle is Embedded.RowStyle.FlatWithRadio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like another one we should move into rowStyle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
...rc/test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodLayoutUITestHelper.kt
Outdated
Show resolved
Hide resolved
@RunWith(RobolectricTestRunner::class) | ||
@Config(sdk = [Build.VERSION_CODES.Q]) | ||
@OptIn(ExperimentalEmbeddedPaymentElementApi::class) | ||
class PaymentMethodLayoutUITestHelper( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach might not be ideal.
It would be easy to add another scenario, but miss adding it for both variants. Maybe we should have a shared test for both, driven by parameterized tests. That would ensure we couldn't miss a test case for the common case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use parameterized tests
@@ -960,6 +960,9 @@ class PaymentSheet internal constructor( | |||
@Parcelize | |||
sealed class RowStyle : Parcelable { | |||
|
|||
internal abstract fun hasSeparators(): Boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a sealed class instead? None, Separators(defaultInset: Boolean)
@@ -33,7 +33,7 @@ import org.robolectric.annotation.Config | |||
@Config(sdk = [Build.VERSION_CODES.Q]) | |||
@OptIn(ExperimentalEmbeddedPaymentElementApi::class) | |||
internal class PaymentMethodVerticalLayoutUITest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this class? Can we rename it so it's easy to know it tests both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to PaymentMethodLayoutUITest
) | ||
} | ||
|
||
OptionalEmbeddedDivider(rowStyle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OptionalEmbeddedDivider
call should be moved inside the paymentMethods.forEachIndexed
block to avoid rendering an extra divider when paymentMethods
is empty. This would prevent visual artifacts in the empty state.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
Summary
Add PaymentMethodEmbeddedLayoutUI
Motivation
MOBILESDK-2851
Testing
Screenshots
Changelog