[fenix] For https://github.com/mozilla-mobile/fenix/issues/23968 - Migrate homescreen recent tabs to compose
For https://github.com/mozilla-mobile/fenix/issues/23968 - Migrate homescreen recent tabs to composepull/600/head
parent
2cfa2e92cd
commit
55baf8333b
@ -1,43 +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/. -->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/home_item_horizontal_margin"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/header"
|
||||
style="@style/Header16TextStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:text="@string/recent_tabs_header"
|
||||
android:gravity="top"
|
||||
android:paddingTop="1dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/show_all_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show_all_button"
|
||||
style="@style/Button14TextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/recent_tabs_show_all_content_description_2"
|
||||
android:insetTop="0dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:maxLines="1"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:text="@string/recent_tabs_show_all"
|
||||
android:textColor="@color/fx_mobile_text_color_accent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/header" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,40 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
package org.mozilla.fenix.home.recenttabs.view
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import androidx.navigation.Navigation
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.databinding.RecentTabsHeaderBinding
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.home.sessioncontrol.SessionControlInteractor
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class RecentTabsHeaderViewHolderTest {
|
||||
|
||||
private lateinit var binding: RecentTabsHeaderBinding
|
||||
private lateinit var interactor: SessionControlInteractor
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
binding = RecentTabsHeaderBinding.inflate(LayoutInflater.from(testContext))
|
||||
Navigation.setViewNavController(binding.root, mockk(relaxed = true))
|
||||
interactor = mockk(relaxed = true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN show all button is clicked THEN interactor is called`() {
|
||||
RecentTabsHeaderViewHolder(binding.root, interactor)
|
||||
|
||||
binding.showAllButton.performClick()
|
||||
|
||||
verify { interactor.onRecentTabShowAllClicked() }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue