From d364900ea138639b00c1ae9d47cba135b06cc1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20Ja=CC=88ckel?= Date: Thu, 1 Apr 2021 12:42:44 +0200 Subject: [PATCH] Additional test case and fix --- .../transactions/details/ButtonStateHelper.kt | 3 +++ .../details/ButtonStateHelperTest.kt | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/app/src/main/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelper.kt b/app/src/main/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelper.kt index 8b2367c88b..9df2a01462 100644 --- a/app/src/main/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelper.kt +++ b/app/src/main/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelper.kt @@ -36,6 +36,9 @@ class ButtonStateHelper( !isRejection && !hasBeenRejected && !needsExecution -> { true } + needsExecution && !canReject && !needsYourConfirmation-> { + false + } !isRejection && !needsYourConfirmation && hasBeenRejected && needsExecution -> { true } diff --git a/app/src/test/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelperTest.kt b/app/src/test/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelperTest.kt index f9cc4fcdda..2c9687a869 100644 --- a/app/src/test/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelperTest.kt +++ b/app/src/test/java/io/gnosis/safe/ui/transactions/details/ButtonStateHelperTest.kt @@ -279,4 +279,26 @@ class ButtonStateHelperTest { assertFalse(buttonStateHelper.confirmButtonIsEnabled()) assertFalse(buttonStateHelper.buttonContainerIsVisible()) } + + @Test + fun `(issue #1346) when (needsExecution & !canReject & !needsYourConfirmation) should hide both buttons`() { + val buttonStateHelper = + ButtonStateHelper( + isRejection = false, + needsYourConfirmation = false, + hasBeenRejected = true, + needsExecution = true, + canReject = false, + isOwner = true, + completed = false + ) + + assertFalse(buttonStateHelper.confirmButtonIsVisible()) + assertFalse(buttonStateHelper.buttonContainerIsVisible()) + assertFalse(buttonStateHelper.rejectButtonIsVisible()) + assertFalse(buttonStateHelper.rejectButtonIsEnabled()) + assertFalse(buttonStateHelper.spacerIsVisible()) + assertFalse(buttonStateHelper.confirmButtonIsEnabled()) + } + }