mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
* Fixed - #4844 : [Bug]: In peer review, deletion proposal is sent even if no reason is chosen * Minor Changes * Minor Fixes * added required changes * added required changes - 1 * Added Test For OK Button * Minor Fixes
This commit is contained in:
parent
16266975d8
commit
c626f97fb9
2 changed files with 56 additions and 12 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.delete
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import com.nhaarman.mockitokotlin2.eq
|
||||
import com.nhaarman.mockitokotlin2.mock
|
||||
|
|
@ -15,6 +16,7 @@ import io.reactivex.Observable
|
|||
import io.reactivex.Single
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
|
@ -142,6 +144,21 @@ class DeleteHelperTest {
|
|||
deleteHelper.askReasonAndExecute(media, mContext, "My Question", ReviewController.DeleteReason.COPYRIGHT_VIOLATION, callback);
|
||||
}
|
||||
|
||||
@Test
|
||||
fun alertDialogPositiveButtonDisableTest() {
|
||||
val mContext = RuntimeEnvironment.getApplication().applicationContext
|
||||
deleteHelper.askReasonAndExecute(media, mContext, "My Question", ReviewController.DeleteReason.COPYRIGHT_VIOLATION, callback);
|
||||
assertEquals(false, deleteHelper.dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun alertDialogPositiveButtonEnableTest() {
|
||||
val mContext = RuntimeEnvironment.getApplication().applicationContext
|
||||
deleteHelper.askReasonAndExecute(media, mContext, "My Question", ReviewController.DeleteReason.COPYRIGHT_VIOLATION, callback);
|
||||
deleteHelper.listener.onClick(deleteHelper.dialog,1,true);
|
||||
assertEquals(true, deleteHelper.dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled)
|
||||
}
|
||||
|
||||
@Test(expected = RuntimeException::class)
|
||||
fun makeDeletionForEmptyCreatorName() {
|
||||
whenever(pageEditClient.prependEdit(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue