Bug 1849073 - Part 7: Remove pill wrapper in search dialog

fenix/121.0
Gabriel Luong 9 months ago committed by mergify[bot]
parent 16be6d9a05
commit ba6f075d2f

@ -323,9 +323,9 @@ class SearchRobot {
onView(withId(R.id.toolbar))
.check(
if (bottomPosition) {
PositionAssertions.isCompletelyBelow(withId(R.id.pill_wrapper_divider))
PositionAssertions.isCompletelyBelow(withId(R.id.keyboard_divider))
} else {
PositionAssertions.isCompletelyAbove(withId(R.id.pill_wrapper_divider))
PositionAssertions.isCompletelyAbove(withId(R.id.keyboard_divider))
},
)
}

@ -22,7 +22,6 @@ import mozilla.components.support.ktx.kotlin.isUrl
import mozilla.components.ui.widgets.withCenterAlignedButtons
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.UnifiedSearch
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
@ -52,7 +51,6 @@ interface SearchController {
fun handleSearchShortcutEngineSelected(searchEngine: SearchEngine)
fun handleClickSearchEngineSettings()
fun handleExistingSessionSelected(tabId: String)
fun handleSearchShortcutsButtonClicked()
fun handleCameraPermissionsNeeded()
fun handleSearchEngineSuggestionClicked(searchEngine: SearchEngine)
@ -158,18 +156,7 @@ class SearchDialogController(
}
override fun handleTextChanged(text: String) {
// Display the search shortcuts on each entry of the search fragment (see #5308)
val textMatchesCurrentUrl = fragmentStore.state.url == text
val textMatchesCurrentSearch = fragmentStore.state.searchTerms == text
fragmentStore.dispatch(SearchFragmentAction.UpdateQuery(text))
fragmentStore.dispatch(
SearchFragmentAction.ShowSearchShortcutEnginePicker(
!settings.showUnifiedSearchFeature &&
(textMatchesCurrentUrl || textMatchesCurrentSearch || text.isEmpty()) &&
settings.shouldShowSearchShortcuts,
),
)
// For felt private browsing mode we're no longer going to prompt the user to enable search
// suggestions while using private browsing mode. The preference to enable them will still
@ -275,16 +262,7 @@ class SearchDialogController(
}
}
if (settings.showUnifiedSearchFeature) {
UnifiedSearch.engineSelected.record(UnifiedSearch.EngineSelectedExtra(searchEngine.telemetryName()))
} else {
SearchShortcuts.selected.record(SearchShortcuts.SelectedExtra(searchEngine.telemetryName()))
}
}
override fun handleSearchShortcutsButtonClicked() {
val isOpen = fragmentStore.state.showSearchShortcuts
fragmentStore.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(!isOpen))
UnifiedSearch.engineSelected.record(UnifiedSearch.EngineSelectedExtra(searchEngine.telemetryName()))
}
override fun handleClickSearchEngineSettings() {

@ -70,7 +70,6 @@ import mozilla.components.support.ktx.android.net.isHttpOrHttps
import mozilla.components.support.ktx.android.view.findViewInHierarchy
import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.kotlin.toNormalizedUrl
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
import mozilla.components.ui.autocomplete.InlineAutocompleteEditText
import mozilla.components.ui.widgets.withCenterAlignedButtons
import org.mozilla.fenix.BrowserDirection
@ -372,47 +371,12 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
else -> {}
}
binding.searchEnginesShortcutButton.increaseTapArea(TAP_INCREASE_DPS)
binding.searchEnginesShortcutButton.isVisible = !showUnifiedSearchFeature
binding.searchEnginesShortcutButton.setOnClickListener {
interactor.onSearchShortcutsButtonClicked()
}
qrFeature.set(
createQrFeature(),
owner = this,
view = view,
)
binding.qrScanButton.isVisible = when {
showUnifiedSearchFeature -> false
requireContext().hasCamera() -> true
else -> false
}
binding.qrScanButton.increaseTapArea(TAP_INCREASE_DPS)
binding.qrScanButton.setOnClickListener {
if (!requireContext().hasCamera()) { return@setOnClickListener }
view.hideKeyboard()
toolbarView.view.clearFocus()
if (requireContext().settings().shouldShowCameraPermissionPrompt) {
qrFeature.get()?.scan(binding.searchWrapper.id)
} else {
if (requireContext().isPermissionGranted(Manifest.permission.CAMERA)) {
qrFeature.get()?.scan(binding.searchWrapper.id)
} else {
interactor.onCameraPermissionsNeeded()
resetFocus()
view.hideKeyboard()
toolbarView.view.requestFocus()
}
}
requireContext().settings().setCameraPermissionNeededState = false
}
binding.fillLinkFromClipboard.setOnClickListener {
Awesomebar.clipboardSuggestionClicked.record(NoExtras())
val clipboardUrl = requireContext().components.clipboardHandler.extractURL() ?: ""
@ -480,7 +444,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
observeClipboardState()
observeAwesomeBarState()
observeShortcutsState()
observeSuggestionProvidersState()
consumeFrom(store) {
@ -528,7 +491,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
private fun hideClipboardSection() {
binding.fillLinkFromClipboard.isVisible = false
binding.fillLinkDivider.isVisible = false
binding.pillWrapperDivider.isVisible = false
binding.keyboardDivider.isVisible = false
binding.clipboardUrl.isVisible = false
binding.clipboardTitle.isVisible = false
binding.linkIcon.isVisible = false
@ -540,11 +503,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
.collect { state -> awesomeBarView.updateSuggestionProvidersVisibility(state) }
}
private fun observeShortcutsState() = consumeFlow(store) { flow ->
flow.ifAnyChanged { state -> arrayOf(state.areShortcutsAvailable, state.showSearchShortcuts) }
.collect { state -> updateSearchShortcutsIcon(state.areShortcutsAvailable, state.showSearchShortcuts) }
}
private fun observeAwesomeBarState() = consumeFlow(store) { flow ->
/*
* firstUpdate is used to make sure we keep the awesomebar hidden on the first run
@ -577,11 +535,8 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
}
private fun updateAccessibilityTraversalOrder() {
val searchWrapperId = binding.searchWrapper.id
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
binding.qrScanButton.accessibilityTraversalAfter = searchWrapperId
binding.searchEnginesShortcutButton.accessibilityTraversalAfter = searchWrapperId
binding.fillLinkFromClipboard.accessibilityTraversalAfter = searchWrapperId
binding.fillLinkFromClipboard.accessibilityTraversalAfter = binding.searchWrapper.id
} else {
viewLifecycleOwner.lifecycleScope.launch {
binding.searchWrapper.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
@ -692,7 +647,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
}.show()
}
} else {
binding.qrScanButton.isChecked = false
activity?.let {
AlertDialog.Builder(it).apply {
val spannable = resources.getSpanned(
@ -741,7 +695,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
}
private fun resetFocus() {
binding.qrScanButton.isChecked = false
toolbarView.view.edit.focus()
toolbarView.view.requestFocus()
}
@ -754,13 +707,13 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
clear(binding.toolbar.id, TOP)
connect(binding.toolbar.id, BOTTOM, PARENT_ID, BOTTOM)
clear(binding.pillWrapper.id, BOTTOM)
connect(binding.pillWrapper.id, BOTTOM, binding.toolbar.id, TOP)
clear(binding.keyboardDivider.id, BOTTOM)
connect(binding.keyboardDivider.id, BOTTOM, binding.toolbar.id, TOP)
clear(binding.awesomeBar.id, TOP)
clear(binding.awesomeBar.id, BOTTOM)
connect(binding.awesomeBar.id, TOP, binding.searchSuggestionsHint.id, BOTTOM)
connect(binding.awesomeBar.id, BOTTOM, binding.pillWrapper.id, TOP)
connect(binding.awesomeBar.id, BOTTOM, binding.keyboardDivider.id, TOP)
clear(binding.searchSuggestionsHint.id, TOP)
clear(binding.searchSuggestionsHint.id, BOTTOM)
@ -768,7 +721,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
connect(binding.searchSuggestionsHint.id, BOTTOM, binding.searchHintBottomBarrier.id, TOP)
clear(binding.fillLinkFromClipboard.id, TOP)
connect(binding.fillLinkFromClipboard.id, BOTTOM, binding.pillWrapper.id, TOP)
connect(binding.fillLinkFromClipboard.id, BOTTOM, binding.keyboardDivider.id, TOP)
clear(binding.fillLinkDivider.id, TOP)
connect(binding.fillLinkDivider.id, BOTTOM, binding.fillLinkFromClipboard.id, TOP)
@ -936,7 +889,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
) {
binding.fillLinkFromClipboard.isVisible = shouldShowView
binding.fillLinkDivider.isVisible = shouldShowView
binding.pillWrapperDivider.isVisible =
binding.keyboardDivider.isVisible =
!(shouldShowView && requireComponents.settings.shouldUseBottomToolbar)
binding.clipboardTitle.isVisible = shouldShowView
binding.linkIcon.isVisible = shouldShowView
@ -992,25 +945,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
inlineAutocompleteEditText.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
}
private fun updateSearchShortcutsIcon(
areShortcutsAvailable: Boolean,
showShortcuts: Boolean,
) {
val showUnifiedSearchFeature = requireContext().settings().showUnifiedSearchFeature
view?.apply {
binding.searchEnginesShortcutButton.isVisible =
!showUnifiedSearchFeature && areShortcutsAvailable
binding.pillWrapper.isVisible = !showUnifiedSearchFeature
binding.searchEnginesShortcutButton.isChecked = showShortcuts
val color = if (showShortcuts) R.attr.textOnColorPrimary else R.attr.textPrimary
binding.searchEnginesShortcutButton.compoundDrawables[0]?.setTint(
requireContext().getColorFromAttr(color),
)
}
}
/**
* Gets the previous visible [NavBackStackEntry].
* This skips over any [NavBackStackEntry] that is associated with a [NavGraph] or refers to this
@ -1043,7 +977,6 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
}
companion object {
private const val TAP_INCREASE_DPS = 8
private const val TAP_INCREASE_DPS_4 = 4
private const val QR_FRAGMENT_TAG = "MOZAC_QR_FRAGMENT"
private const val REQUEST_CODE_CAMERA_PERMISSIONS = 1

@ -51,10 +51,6 @@ class SearchDialogInteractor(
searchController.handleSearchShortcutEngineSelected(searchEngine)
}
override fun onSearchShortcutsButtonClicked() {
searchController.handleSearchShortcutsButtonClicked()
}
override fun onClickSearchEngineSettings() {
searchController.handleClickSearchEngineSettings()
}

@ -236,11 +236,6 @@ sealed class SearchFragmentAction : Action {
*/
data class SearchTabsEngineSelected(val engine: SearchEngine) : SearchFragmentAction()
/**
* Action when search engine picker is selected.
*/
data class ShowSearchShortcutEnginePicker(val show: Boolean) : SearchFragmentAction()
/**
* Action when allow search suggestion in private mode hint is tapped.
*/
@ -383,8 +378,6 @@ private fun searchStateReducer(state: SearchFragmentState, action: SearchFragmen
showSponsoredSuggestions = false,
showNonSponsoredSuggestions = false,
)
is SearchFragmentAction.ShowSearchShortcutEnginePicker ->
state.copy(showSearchShortcuts = action.show && state.areShortcutsAvailable)
is SearchFragmentAction.UpdateQuery ->
state.copy(query = action.query)
is SearchFragmentAction.AllowSearchSuggestionsInPrivateModePrompt ->

@ -48,11 +48,6 @@ interface AwesomeBarInteractor {
*/
fun onExistingSessionSelected(tabId: String)
/**
* Called whenever the Shortcuts button is clicked
*/
fun onSearchShortcutsButtonClicked()
/**
* Called whenever search engine suggestion is tapped
*/

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/textOnColorPrimary" android:state_checked="true" />
<!-- Default State -->
<item android:color="?attr/textPrimary" />
</selector>

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="4dp"
android:top="4dp">
<shape>
<solid android:color="?accentBright" />
<stroke
android:width="1dp"
android:color="?accentBright" />
<corners android:radius="16dp" />
</shape>
</item>
</layer-list>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/layer1"/>
<corners android:radius="16dp"/>
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/search_pill_background" android:state_checked="true" />
<item android:drawable="@drawable/search_pill_background_unselected" />
</selector>

@ -57,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="awesome_bar,pill_wrapper"/>
app:constraint_referenced_ids="awesome_bar,keyboard_divider"/>
<org.mozilla.fenix.search.awesomebar.AwesomeBarWrapper
android:id="@+id/awesome_bar"
@ -69,7 +69,7 @@
android:requiresFadingEdge="vertical"
android:background="?attr/layer1"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="@+id/pill_wrapper"
app:layout_constraintBottom_toTopOf="@+id/keyboard_divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_suggestions_hint" />
@ -149,44 +149,9 @@
app:layout_constraintTop_toBottomOf="@id/fill_link_from_clipboard" />
<View
android:id="@+id/pill_wrapper_divider"
android:id="@+id/keyboard_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?borderPrimary"
app:layout_constraintBottom_toTopOf="@id/pill_wrapper" />
<View
android:id="@+id/pill_wrapper"
android:layout_width="0dp"
android:layout_height="@dimen/search_fragment_pill_height"
android:background="?attr/layer1"
android:importantForAccessibility="no"
android:paddingStart="@dimen/search_fragment_pill_padding_start"
android:paddingTop="@dimen/search_fragment_pill_padding_vertical"
android:paddingEnd="@dimen/search_fragment_pill_padding_end"
android:paddingBottom="@dimen/search_fragment_pill_padding_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ToggleButton
android:id="@+id/qr_scan_button"
style="@style/search_pill"
android:layout_marginEnd="@dimen/search_fragment_scan_button_margin_end"
android:textOff="@string/search_scan_button"
android:textOn="@string/search_scan_button"
app:drawableStartCompat="@drawable/ic_qr"
app:layout_constraintBottom_toBottomOf="@id/pill_wrapper"
app:layout_constraintStart_toStartOf="@id/pill_wrapper"
app:layout_constraintTop_toTopOf="@id/pill_wrapper" />
<ToggleButton
android:id="@+id/search_engines_shortcut_button"
style="@style/search_pill"
android:textOff="@string/search_engine_button"
android:textOn="@string/search_engine_button"
app:drawableStartCompat="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/pill_wrapper"
app:layout_constraintStart_toEndOf="@id/qr_scan_button"
app:layout_constraintTop_toTopOf="@id/pill_wrapper" />
app:layout_constraintBottom_toBottomOf="parent" />
</org.mozilla.fenix.perf.SearchDialogFragmentConstraintLayout>

@ -93,11 +93,6 @@
<dimen name="search_fragment_clipboard_item_height">56dp</dimen>
<dimen name="search_fragment_clipboard_item_horizontal_margin">8dp</dimen>
<dimen name="search_fragment_clipboard_item_title_margin_start">8dp</dimen>
<dimen name="search_fragment_pill_height">40dp</dimen>
<dimen name="search_fragment_pill_padding_start">20dp</dimen>
<dimen name="search_fragment_pill_padding_end">16dp</dimen>
<dimen name="search_fragment_pill_padding_vertical">4dp</dimen>
<dimen name="search_fragment_scan_button_margin_end">8dp</dimen>
<dimen name="search_fragment_clipboard_title_text_size">15sp</dimen>

@ -252,7 +252,7 @@
<!-- Button in the search view that lets a user search by scanning a QR code -->
<string name="search_scan_button">Scan</string>
<!-- Button in the search view that lets a user change their search engine -->
<string name="search_engine_button">Search engine</string>
<string name="search_engine_button" moz:RemovedIn="121" tools:ignore="UnusedResources">Search engine</string>
<!-- Button in the search view when shortcuts are displayed that takes a user to the search engine settings -->
<string name="search_shortcuts_engine_settings">Search engine settings</string>
<!-- Button in the search view that lets a user navigate to the site in their clipboard -->

@ -381,26 +381,6 @@
<item name="android:textColor">?textActionPrimary</item>
</style>
<style name="search_pill" parent="Widget.AppCompat.Button.Borderless">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">40dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/toggle_text_color</item>
<item name="drawableTint">@color/toggle_text_color</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:gravity">center_vertical</item>
<item name="android:singleLine">true</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">16dp</item>
<item name="android:drawablePadding">8dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:minHeight">0dp</item>
<item name="android:background">@drawable/search_pill_drawable_button_background</item>
</style>
<style name="DialogStyleBase" parent="NormalTheme">
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
<item name="android:colorControlNormal">?accentHighContrast</item>

@ -42,7 +42,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.UnifiedSearch
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
@ -417,109 +416,6 @@ class SearchDialogControllerTest {
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `show search shortcuts when setting enabled AND query empty`() {
val text = ""
every { settings.shouldShowSearchShortcuts } returns true
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(true)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `show search shortcuts when setting enabled AND query equals url`() {
val text = "mozilla.org"
every { store.state.url } returns "mozilla.org"
every { settings.shouldShowSearchShortcuts } returns true
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(true)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `GIVEN show search shortcuts setting is enabled AND unified search is enabled WHEN query is empty THEN do not show search shortcuts`() {
val text = ""
every { settings.shouldShowSearchShortcuts } returns true
every { settings.showUnifiedSearchFeature } returns true
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `GIVEN show search shortcuts setting is enabled AND unified search is enabled WHEN query is url THEN do not show search shortcuts`() {
val text = "mozilla.org"
every { store.state.url } returns "mozilla.org"
every { settings.shouldShowSearchShortcuts } returns true
every { settings.showUnifiedSearchFeature } returns true
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `do not show search shortcuts when setting enabled AND query non-empty`() {
val text = "mozilla"
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `do not show search shortcuts when setting disabled AND query empty AND url not matching query`() {
every { settings.shouldShowSearchShortcuts } returns false
val text = ""
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `do not show search shortcuts when setting disabled AND query non-empty`() {
every { settings.shouldShowSearchShortcuts } returns false
val text = "mozilla"
createController().handleTextChanged(text)
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun `WHEN felt privacy is enabled THEN do not dispatch AllowSearchSuggestionsInPrivateModePrompt`() {
every { settings.feltPrivateBrowsingEnabled } returns true
@ -630,8 +526,8 @@ class SearchDialogControllerTest {
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
assertNotNull(SearchShortcuts.selected.testGetValue())
val recordedEvents = SearchShortcuts.selected.testGetValue()!!
assertNotNull(UnifiedSearch.engineSelected.testGetValue())
val recordedEvents = UnifiedSearch.engineSelected.testGetValue()!!
assertEquals(1, recordedEvents.size)
val eventExtra = recordedEvents.single().extra
assertNotNull(eventExtra)
@ -644,7 +540,6 @@ class SearchDialogControllerTest {
val searchEngine: SearchEngine = mockk(relaxed = true)
every { searchEngine.type } returns SearchEngine.Type.APPLICATION
every { searchEngine.id } returns Core.HISTORY_SEARCH_ENGINE_ID
every { settings.showUnifiedSearchFeature } returns true
assertNull(UnifiedSearch.engineSelected.testGetValue())
@ -676,7 +571,6 @@ class SearchDialogControllerTest {
val searchEngine: SearchEngine = mockk(relaxed = true)
every { searchEngine.type } returns SearchEngine.Type.APPLICATION
every { searchEngine.id } returns Core.BOOKMARKS_SEARCH_ENGINE_ID
every { settings.showUnifiedSearchFeature } returns true
assertNull(UnifiedSearch.engineSelected.testGetValue())
@ -708,7 +602,6 @@ class SearchDialogControllerTest {
val searchEngine: SearchEngine = mockk(relaxed = true)
every { searchEngine.type } returns SearchEngine.Type.APPLICATION
every { searchEngine.id } returns Core.TABS_SEARCH_ENGINE_ID
every { settings.showUnifiedSearchFeature } returns true
assertNull(UnifiedSearch.engineSelected.testGetValue())
@ -750,32 +643,6 @@ class SearchDialogControllerTest {
}
}
@Test
fun handleSearchShortcutsButtonClicked_alreadyOpen() {
every { store.state.showSearchShortcuts } returns true
createController().handleSearchShortcutsButtonClicked()
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(false)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun handleSearchShortcutsButtonClicked_notYetOpen() {
every { store.state.showSearchShortcuts } returns false
createController().handleSearchShortcutsButtonClicked()
browserStore.waitUntilIdle()
verify { store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(true)) }
middleware.assertNotDispatched(AwesomeBarAction.EngagementFinished::class)
}
@Test
fun handleExistingSessionSelected() {
createController().handleExistingSessionSelected("selected")

@ -86,13 +86,6 @@ class SearchDialogInteractorTest {
verify { searchController.handleSearchShortcutEngineSelected(searchEngine) }
}
@Test
fun onSearchShortcutsButtonClicked() {
interactor.onSearchShortcutsButtonClicked()
verify { searchController.handleSearchShortcutsButtonClicked() }
}
@Test
fun onClickSearchEngineSettings() {
interactor.onClickSearchEngineSettings()

@ -963,16 +963,6 @@ class SearchFragmentStoreTest {
assertEquals(SearchEngineSource.Tabs(searchEngine), store.state.searchEngineSource)
}
@Test
fun showSearchShortcutEnginePicker() = runTest {
val initialState = emptyDefaultState()
val store = SearchFragmentStore(initialState)
store.dispatch(SearchFragmentAction.ShowSearchShortcutEnginePicker(true)).join()
assertNotSame(initialState, store.state)
assertEquals(true, store.state.showSearchShortcuts)
}
@Test
fun showSearchSuggestions() = runTest {
val initialState = emptyDefaultState()

Loading…
Cancel
Save