-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Link Button content descriptions (#9350)
* Improve Link Button content descriptions * Update screenshots
- Loading branch information
1 parent
d36b4dc
commit 4260dad
Showing
18 changed files
with
78 additions
and
12 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
45 changes: 45 additions & 0 deletions
45
link/src/test/java/com/stripe/android/link/ui/LinkButtonTest.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,45 @@ | ||
package com.stripe.android.link.ui | ||
|
||
import android.os.Build | ||
import androidx.compose.ui.test.assertAny | ||
import androidx.compose.ui.test.assertContentDescriptionContains | ||
import androidx.compose.ui.test.hasContentDescription | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onChildren | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import org.robolectric.annotation.Config | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
@Config(sdk = [Build.VERSION_CODES.Q]) | ||
class LinkButtonTest { | ||
@get:Rule | ||
val composeRule = createComposeRule() | ||
|
||
@Test | ||
fun signedInButton_hasUsefulContentDescription() { | ||
composeRule.setContent { | ||
LinkButton(email = "email@email.com", enabled = true, onClick = {}) | ||
} | ||
|
||
composeRule.onNodeWithTag( | ||
LinkButtonTestTag | ||
).onChildren().assertAny( | ||
hasContentDescription("Pay with Link") | ||
) | ||
} | ||
|
||
@Test | ||
fun signedOutButton_hasUsefulContentDescription() { | ||
composeRule.setContent { | ||
LinkButton(email = null, enabled = true, onClick = {}) | ||
} | ||
|
||
composeRule.onNodeWithTag( | ||
LinkButtonTestTag | ||
).assertContentDescriptionContains("Pay with Link") | ||
} | ||
} |
Binary file modified
BIN
+38 Bytes
(100%)
...ui_LinkButtonScreenshotTest_testExistingUserDisabled[DarkTheme,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 modified
BIN
-116 Bytes
(99%)
...k.ui_LinkButtonScreenshotTest_testExistingUserDisabled[DarkTheme,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 modified
BIN
+37 Bytes
(100%)
...i_LinkButtonScreenshotTest_testExistingUserDisabled[LightTheme,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 modified
BIN
-116 Bytes
(99%)
....ui_LinkButtonScreenshotTest_testExistingUserDisabled[LightTheme,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 modified
BIN
-104 Bytes
(99%)
...ScreenshotTest_testExistingUserWithLongEmailDisabled[DarkTheme,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 modified
BIN
+29 Bytes
(100%)
...onScreenshotTest_testExistingUserWithLongEmailDisabled[DarkTheme,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 modified
BIN
-104 Bytes
(99%)
...creenshotTest_testExistingUserWithLongEmailDisabled[LightTheme,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 modified
BIN
+28 Bytes
(100%)
...nScreenshotTest_testExistingUserWithLongEmailDisabled[LightTheme,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 modified
BIN
-30 Bytes
(100%)
...nkButtonScreenshotTest_testExistingUserWithLongEmail[DarkTheme,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 modified
BIN
+136 Bytes
(100%)
...LinkButtonScreenshotTest_testExistingUserWithLongEmail[DarkTheme,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 modified
BIN
-36 Bytes
(100%)
...kButtonScreenshotTest_testExistingUserWithLongEmail[LightTheme,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 modified
BIN
+139 Bytes
(100%)
...inkButtonScreenshotTest_testExistingUserWithLongEmail[LightTheme,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 modified
BIN
-86 Bytes
(99%)
...id.link.ui_LinkButtonScreenshotTest_testExistingUser[DarkTheme,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 modified
BIN
-13 Bytes
(100%)
...roid.link.ui_LinkButtonScreenshotTest_testExistingUser[DarkTheme,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 modified
BIN
-92 Bytes
(99%)
...d.link.ui_LinkButtonScreenshotTest_testExistingUser[LightTheme,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 modified
BIN
-8 Bytes
(100%)
...oid.link.ui_LinkButtonScreenshotTest_testExistingUser[LightTheme,LargeFont].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.