No issue: Remove feature flag for tips (#12172)
parent
f59c64b68e
commit
306505fee0
|
@ -10,11 +10,6 @@ object FeatureFlags {
|
|||
*/
|
||||
const val pullToRefreshEnabled = false
|
||||
|
||||
/**
|
||||
* Enables tip feature
|
||||
*/
|
||||
val tips = Config.channel.isDebug
|
||||
|
||||
/**
|
||||
* Allows edit of saved logins.
|
||||
*/
|
||||
|
@ -29,10 +24,4 @@ object FeatureFlags {
|
|||
* Enables new tab tray pref
|
||||
*/
|
||||
val tabTray = Config.channel.isNightlyOrDebug
|
||||
|
||||
/**
|
||||
* Allows search widget CFR to be displayed.
|
||||
* This is a placeholder for the experimentation framework determining cohorts.
|
||||
*/
|
||||
val searchWidgetCFR = Config.channel.isDebug
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.components.tips
|
||||
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
|
||||
sealed class TipType {
|
||||
data class Button(val text: String, val action: () -> Unit) : TipType()
|
||||
}
|
||||
|
@ -31,7 +29,6 @@ class FenixTipManager(
|
|||
private val providers: List<TipProvider>
|
||||
) : TipManager {
|
||||
override fun getTip(): Tip? {
|
||||
if (!FeatureFlags.tips) { return null }
|
||||
return providers
|
||||
.firstOrNull { it.shouldDisplay }
|
||||
?.tip
|
||||
|
|
|
@ -4,54 +4,12 @@
|
|||
|
||||
package org.mozilla.fenix.components.tips
|
||||
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkObject
|
||||
import io.mockk.unmockkObject
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
|
||||
class TipManagerTest {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
mockkObject(FeatureFlags)
|
||||
every { FeatureFlags.tips } returns true
|
||||
}
|
||||
|
||||
@After
|
||||
fun after() {
|
||||
unmockkObject(FeatureFlags)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test feature flag off`() {
|
||||
every { FeatureFlags.tips } returns false
|
||||
assertNull(FenixTipManager(emptyList()).getTip())
|
||||
assertNull(FenixTipManager(listOf(
|
||||
object : TipProvider {
|
||||
override val tip = mockk<Tip>()
|
||||
override val shouldDisplay = true
|
||||
},
|
||||
object : TipProvider {
|
||||
override val tip = mockk<Tip>()
|
||||
override val shouldDisplay = false
|
||||
},
|
||||
object : TipProvider {
|
||||
override val tip: Tip? = null
|
||||
override val shouldDisplay = true
|
||||
},
|
||||
object : TipProvider {
|
||||
override val tip: Tip? = null
|
||||
override val shouldDisplay = false
|
||||
}
|
||||
)).getTip())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test first with shouldDisplay`() {
|
||||
val shouldDisplayProvider = object : TipProvider {
|
||||
|
|
Loading…
Reference in New Issue