|
|
|
@ -8,6 +8,7 @@ import android.net.Uri
|
|
|
|
|
import android.text.method.LinkMovementMethod
|
|
|
|
|
import android.view.LayoutInflater
|
|
|
|
|
import android.view.View
|
|
|
|
|
import android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO
|
|
|
|
|
import androidx.core.view.isVisible
|
|
|
|
|
import io.mockk.mockk
|
|
|
|
|
import io.mockk.verify
|
|
|
|
@ -66,9 +67,14 @@ class AddonDetailsBindingDelegateTest {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
assertEquals("4.30/5", binding.ratingView.contentDescription)
|
|
|
|
|
assertEquals(4.5f, binding.ratingView.rating)
|
|
|
|
|
assertEquals("100", binding.reviewCount.text)
|
|
|
|
|
val ratingContentDescription = testContext.getString(R.string.mozac_feature_addons_rating_content_description)
|
|
|
|
|
|
|
|
|
|
val formattedRatting = String.format(ratingContentDescription, 4.3f)
|
|
|
|
|
val expectedContentDescription = binding.ratingLabel.text.toString() + " " + formattedRatting
|
|
|
|
|
assertEquals(expectedContentDescription, binding.ratingLabel.contentDescription)
|
|
|
|
|
assertEquals(IMPORTANT_FOR_ACCESSIBILITY_NO, binding.ratingView.importantForAccessibility)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -104,6 +110,9 @@ class AddonDetailsBindingDelegateTest {
|
|
|
|
|
detailsBindingDelegate.bind(baseAddon)
|
|
|
|
|
|
|
|
|
|
assertEquals("Nov 23, 2020", binding.lastUpdatedText.text)
|
|
|
|
|
val expectedContentDescription = binding.lastUpdatedLabel.text.toString() + " " + "Nov 23, 2020"
|
|
|
|
|
assertEquals(expectedContentDescription, binding.lastUpdatedLabel.contentDescription)
|
|
|
|
|
assertEquals(IMPORTANT_FOR_ACCESSIBILITY_NO, binding.lastUpdatedText.importantForAccessibility)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -130,6 +139,9 @@ class AddonDetailsBindingDelegateTest {
|
|
|
|
|
assertEquals("2.0.0", binding.versionText.text)
|
|
|
|
|
binding.versionText.performLongClick()
|
|
|
|
|
verify { interactor.showUpdaterDialog(addon2) }
|
|
|
|
|
val expectedContentDescription = binding.versionLabel.text.toString() + " 2.0.0"
|
|
|
|
|
assertEquals(expectedContentDescription, binding.versionLabel.contentDescription)
|
|
|
|
|
assertEquals(IMPORTANT_FOR_ACCESSIBILITY_NO, binding.versionText.importantForAccessibility)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -140,6 +152,9 @@ class AddonDetailsBindingDelegateTest {
|
|
|
|
|
|
|
|
|
|
assertEquals("Sarah Jane", binding.authorText.text)
|
|
|
|
|
assertNotEquals(testContext.getColorFromAttr(R.attr.textAccent), binding.authorText.currentTextColor)
|
|
|
|
|
val expectedContentDescription = binding.authorLabel.text.toString() + " Sarah Jane"
|
|
|
|
|
assertEquals(expectedContentDescription, binding.authorLabel.contentDescription)
|
|
|
|
|
assertEquals(IMPORTANT_FOR_ACCESSIBILITY_NO, binding.authorText.importantForAccessibility)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|