Skip to content

Commit

Permalink
Fix #2207: Admin Auth A11y scanner checks passed (#2736)
Browse files Browse the repository at this point in the history
* Fixed ally issues

* Removed isClickable and added more tests

* Nit fix

Co-authored-by: Rajat Talesra <[email protected]>
Co-authored-by: Ben Henning <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2021
1 parent e0fb0e4 commit 2de692a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/src/main/res/layout-land/admin_auth_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
style="@style/StateButtonActive"
android:layout_marginTop="44dp"
android:background="@{viewModel.isSubmitButtonActive ? @drawable/state_button_primary_background :@drawable/start_button_transparent_background}"
android:clickable="@{viewModel.isSubmitButtonActive}"
android:enabled="@{viewModel.isSubmitButtonActive}"
android:minHeight="48dp"
android:text="@string/admin_auth_submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
style="@style/StateButtonActive"
android:layout_marginTop="58dp"
android:background="@{viewModel.isSubmitButtonActive ? @drawable/state_button_primary_background :@drawable/start_button_transparent_background}"
android:clickable="@{viewModel.isSubmitButtonActive}"
android:enabled="@{viewModel.isSubmitButtonActive}"
android:minHeight="36dp"
android:text="@string/admin_auth_submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
android:layout_marginTop="48dp"
android:layout_marginBottom="44dp"
android:background="@{viewModel.isSubmitButtonActive ? @drawable/state_button_primary_background :@drawable/start_button_transparent_background}"
android:clickable="@{viewModel.isSubmitButtonActive}"
android:enabled="@{viewModel.isSubmitButtonActive}"
android:minHeight="36dp"
android:text="@string/admin_auth_submit"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/admin_auth_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
android:layout_marginEnd="28dp"
android:layout_marginBottom="44dp"
android:background="@{viewModel.isSubmitButtonActive ? @drawable/state_button_primary_background :@drawable/start_button_transparent_background}"
android:clickable="@{viewModel.isSubmitButtonActive}"
android:enabled="@{viewModel.isSubmitButtonActive}"
android:minHeight="48dp"
android:text="@string/admin_auth_submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import dagger.Component
import org.hamcrest.Description
import org.hamcrest.Matcher
import org.hamcrest.Matchers.allOf
import org.hamcrest.Matchers.not
import org.hamcrest.TypeSafeMatcher
import org.junit.After
import org.junit.Before
Expand Down Expand Up @@ -333,6 +334,45 @@ class AdminAuthActivityTest {
}
}

@Test
fun testAdminAuthActivity_defaultButtonState_isDisabled() {
launch<AdminAuthActivity>(
AdminAuthActivity.createAdminAuthActivityIntent(
context = context,
adminPin = "12345",
profileId = internalProfileId,
colorRgb = -10710042,
adminPinEnum = AdminAuthEnum.PROFILE_ADMIN_CONTROLS.value
)
).use {
onView(withId(R.id.admin_auth_submit_button)).check(matches(not(isEnabled())))
}
}

@Test
fun testAdminAuthActivity_inputPin_buttonStateIsEnabled() {
launch<AdminAuthActivity>(
AdminAuthActivity.createAdminAuthActivityIntent(
context = context,
adminPin = "12345",
profileId = internalProfileId,
colorRgb = -10710042,
adminPinEnum = AdminAuthEnum.PROFILE_ADMIN_CONTROLS.value
)
).use {
onView(
allOf(
withId(R.id.admin_auth_input_pin_edit_text),
isDescendantOfA(withId(R.id.admin_auth_input_pin))
)
).perform(
editTextInputAction.appendText("12345"),
closeSoftKeyboard()
)
onView(withId(R.id.admin_auth_submit_button)).check(matches(isEnabled()))
}
}

@Test
fun testAdminAuthActivity_buttonState_configChange_buttonStateIsPreserved() {
launch<AdminAuthActivity>(
Expand Down

0 comments on commit 2de692a

Please sign in to comment.