For #24616 - Update all the strings that references "top site" to "shortcut"
This commit is contained in:
parent
a4dc80adbc
commit
8b01528f5b
|
@ -11,11 +11,13 @@ import org.junit.After
|
|||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.customannotations.SmokeTest
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.FeatureSettingsHelper
|
||||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
||||
import org.mozilla.fenix.ui.robots.browserScreen
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
import org.mozilla.fenix.ui.robots.navigationToolbar
|
||||
|
@ -65,7 +67,7 @@ class TopSitesTest {
|
|||
expandMenu()
|
||||
verifyAddToTopSitesButton()
|
||||
}.addToFirefoxHome {
|
||||
verifySnackBarText("Added to top sites!")
|
||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||
}.goToHomescreen {
|
||||
verifyExistingTopSitesList()
|
||||
verifyExistingTopSitesTabs(defaultWebPageTitle)
|
||||
|
@ -83,7 +85,7 @@ class TopSitesTest {
|
|||
expandMenu()
|
||||
verifyAddToTopSitesButton()
|
||||
}.addToFirefoxHome {
|
||||
verifySnackBarText("Added to top sites!")
|
||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||
}.goToHomescreen {
|
||||
verifyExistingTopSitesList()
|
||||
verifyExistingTopSitesTabs(defaultWebPageTitle)
|
||||
|
@ -111,7 +113,7 @@ class TopSitesTest {
|
|||
expandMenu()
|
||||
verifyAddToTopSitesButton()
|
||||
}.addToFirefoxHome {
|
||||
verifySnackBarText("Added to top sites!")
|
||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||
}.goToHomescreen {
|
||||
verifyExistingTopSitesList()
|
||||
verifyExistingTopSitesTabs(defaultWebPageTitle)
|
||||
|
@ -134,7 +136,7 @@ class TopSitesTest {
|
|||
expandMenu()
|
||||
verifyAddToTopSitesButton()
|
||||
}.addToFirefoxHome {
|
||||
verifySnackBarText("Added to top sites!")
|
||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||
}.goToHomescreen {
|
||||
verifyExistingTopSitesList()
|
||||
verifyExistingTopSitesTabs(defaultWebPageTitle)
|
||||
|
@ -157,7 +159,7 @@ class TopSitesTest {
|
|||
expandMenu()
|
||||
verifyAddToTopSitesButton()
|
||||
}.addToFirefoxHome {
|
||||
verifySnackBarText("Added to top sites!")
|
||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||
}.goToHomescreen {
|
||||
verifyExistingTopSitesList()
|
||||
verifyExistingTopSitesTabs(defaultWebPageTitle)
|
||||
|
|
|
@ -494,13 +494,13 @@ private fun assertReaderViewAppearanceButton(visible: Boolean) {
|
|||
}
|
||||
|
||||
private fun addToTopSitesButton() =
|
||||
onView(allOf(withText(R.string.browser_menu_add_to_top_sites)))
|
||||
onView(allOf(withText(R.string.browser_menu_add_to_shortcuts)))
|
||||
|
||||
private fun assertAddToTopSitesButton() {
|
||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_top_sites))
|
||||
hasDescendant(withText(R.string.browser_menu_add_to_shortcuts))
|
||||
)
|
||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
}
|
||||
|
|
|
@ -256,8 +256,8 @@ class DefaultBrowserToolbarMenuController(
|
|||
|
||||
if (numPinnedSites >= settings.topSitesMaxLimit) {
|
||||
AlertDialog.Builder(swipeRefresh.context).apply {
|
||||
setTitle(R.string.top_sites_max_limit_title)
|
||||
setMessage(R.string.top_sites_max_limit_content_2)
|
||||
setTitle(R.string.shortcut_max_limit_title)
|
||||
setMessage(R.string.shortcut_max_limit_content)
|
||||
setPositiveButton(R.string.top_sites_max_limit_confirmation_button) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ class DefaultBrowserToolbarMenuController(
|
|||
isDisplayedWithBrowserToolbar = true
|
||||
)
|
||||
.setText(
|
||||
context.getString(R.string.snackbar_added_to_top_sites)
|
||||
context.getString(R.string.snackbar_added_to_shortcuts)
|
||||
)
|
||||
.show()
|
||||
}
|
||||
|
|
|
@ -274,8 +274,8 @@ open class DefaultToolbarMenu(
|
|||
}
|
||||
|
||||
val addRemoveTopSitesItem = TwoStateBrowserMenuImageText(
|
||||
primaryLabel = context.getString(R.string.browser_menu_add_to_top_sites),
|
||||
secondaryLabel = context.getString(R.string.browser_menu_remove_from_top_sites),
|
||||
primaryLabel = context.getString(R.string.browser_menu_add_to_shortcuts),
|
||||
secondaryLabel = context.getString(R.string.browser_menu_remove_from_shortcuts),
|
||||
primaryStateIconResource = R.drawable.ic_top_sites,
|
||||
secondaryStateIconResource = R.drawable.ic_top_sites,
|
||||
iconTintColorResource = primaryTextColor(),
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
android:layout_marginEnd="24dp"
|
||||
android:autofillHints="false"
|
||||
android:backgroundTint="?borderPrimary"
|
||||
android:hint="@string/top_site_name_hint"
|
||||
android:hint="@string/shortcut_name_hint"
|
||||
android:inputType="textCapSentences"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="viewStart" />
|
||||
|
|
|
@ -1045,7 +1045,9 @@
|
|||
<!-- Text shown in snackbar when user bookmarks a list of tabs -->
|
||||
<string name="snackbar_message_bookmarks_saved">Bookmarks saved!</string>
|
||||
<!-- Text shown in snackbar when user adds a site to top sites -->
|
||||
<string name="snackbar_added_to_top_sites">Added to top sites!</string>
|
||||
<string name="snackbar_added_to_top_sites" moz:RemovedIn="101" tools:ignore="UnusedResources">Added to top sites!</string>
|
||||
<!-- Text shown in snackbar when user adds a site to shortcuts -->
|
||||
<string name="snackbar_added_to_shortcuts">Added to shorcuts!</string>
|
||||
<!-- Text shown in snackbar when user closes a private tab -->
|
||||
<string name="snackbar_private_tab_closed">Private tab closed</string>
|
||||
<!-- Text shown in snackbar when user closes all private tabs -->
|
||||
|
@ -1620,9 +1622,13 @@
|
|||
<!-- Bookmark deletion confirmation -->
|
||||
<string name="bookmark_deletion_confirmation">Are you sure you want to delete this bookmark?</string>
|
||||
<!-- Browser menu button that adds a top site to the home fragment -->
|
||||
<string name="browser_menu_add_to_top_sites">Add to top sites</string>
|
||||
<string name="browser_menu_add_to_top_sites" moz:RemovedIn="101" tools:ignore="UnusedResources">Add to top sites</string>
|
||||
<!-- Browser menu button that removes a top site from the home fragment -->
|
||||
<string name="browser_menu_remove_from_top_sites">Remove from top sites</string>
|
||||
<string name="browser_menu_remove_from_top_sites" moz:RemovedIn="101" tools:ignore="UnusedResources">Remove from top sites</string>
|
||||
<!-- Browser menu button that adds a shortcut to the home fragment -->
|
||||
<string name="browser_menu_add_to_shortcuts">Add to shortcuts</string>
|
||||
<!-- Browser menu button that removes a shortcut from the home fragment -->
|
||||
<string name="browser_menu_remove_from_shortcuts">Remove from shortcuts</string>
|
||||
<!-- text shown before the issuer name to indicate who its verified by, parameter is the name of
|
||||
the certificate authority that verified the ticket-->
|
||||
<string name="certificate_info_verified_by">Verified By: %1$s </string>
|
||||
|
@ -1693,9 +1699,13 @@
|
|||
|
||||
<!-- Top Sites -->
|
||||
<!-- Title text displayed in the dialog when top sites limit is reached. -->
|
||||
<string name="top_sites_max_limit_title">Top site limit reached</string>
|
||||
<string name="top_sites_max_limit_title" moz:RemovedIn="101" tools:ignore="UnusedResources">Top site limit reached</string>
|
||||
<!-- Title text displayed in the dialog when shortcuts limit is reached. -->
|
||||
<string name="shortcut_max_limit_title">Shortcut limit reached</string>
|
||||
<!-- Content description text displayed in the dialog when top sites limit is reached. -->
|
||||
<string name="top_sites_max_limit_content_2">To add a new top site, remove one. Touch and hold the site and select remove.</string>
|
||||
<string name="top_sites_max_limit_content_2" moz:RemovedIn="101" tools:ignore="UnusedResources">To add a new top site, remove one. Touch and hold the site and select remove.</string>
|
||||
<!-- Content description text displayed in the dialog when shortcut limit is reached. -->
|
||||
<string name="shortcut_max_limit_content">To add a new shortcut, remove one. Touch and hold the site and select remove.</string>
|
||||
<!-- Confirmation dialog button text when top sites limit is reached. -->
|
||||
<string name="top_sites_max_limit_confirmation_button">OK, Got It</string>
|
||||
<!-- Label for the preference to show the shortcuts for the most visited top sites on the homepage -->
|
||||
|
@ -1703,7 +1713,9 @@
|
|||
<!-- Title text displayed in the rename top site dialog. -->
|
||||
<string name="top_sites_rename_dialog_title">Name</string>
|
||||
<!-- Hint for renaming title of a top site -->
|
||||
<string name="top_site_name_hint">Top site name</string>
|
||||
<string name="top_site_name_hint" moz:RemovedIn="101" tools:ignore="UnusedResources">Top site name</string>
|
||||
<!-- Hint for renaming title of a shortcut -->
|
||||
<string name="shortcut_name_hint">Shortcut name</string>
|
||||
<!-- Button caption to confirm the renaming of the top site. -->
|
||||
<string name="top_sites_rename_dialog_ok">OK</string>
|
||||
<!-- Dialog button text for canceling the rename top site prompt. -->
|
||||
|
|
|
@ -414,25 +414,25 @@ class DefaultBrowserToolbarMenuControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN Add To Top Sites menu item is pressed THEN add site AND show snackbar`() = runBlockingTest {
|
||||
fun `WHEN add to shortcuts menu item is pressed THEN add site AND show snackbar`() = runBlockingTest {
|
||||
val item = ToolbarMenu.Item.AddToTopSites
|
||||
val addPinnedSiteUseCase: TopSitesUseCases.AddPinnedSiteUseCase = mockk(relaxed = true)
|
||||
|
||||
every { topSitesUseCase.addPinnedSites } returns addPinnedSiteUseCase
|
||||
every {
|
||||
swipeRefreshLayout.context.getString(R.string.snackbar_added_to_top_sites)
|
||||
} returns "Added to top sites!"
|
||||
swipeRefreshLayout.context.getString(R.string.snackbar_added_to_shortcuts)
|
||||
} returns "Added to shorcuts!"
|
||||
|
||||
val controller = createController(scope = this, store = browserStore)
|
||||
controller.handleToolbarItemInteraction(item)
|
||||
|
||||
verify { addPinnedSiteUseCase.invoke(selectedTab.content.title, selectedTab.content.url) }
|
||||
verify { snackbar.setText("Added to top sites!") }
|
||||
verify { snackbar.setText("Added to shorcuts!") }
|
||||
verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.ADD_TO_TOP_SITES)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN a top site page is open WHEN Remove from top sites is pressed THEN show snackbar`() = runBlockingTest {
|
||||
fun `GIVEN a shortcut page is open WHEN remove from shortcuts is pressed THEN show snackbar`() = runBlockingTest {
|
||||
val snackbarMessage = "Site removed"
|
||||
val item = ToolbarMenu.Item.RemoveFromTopSites
|
||||
val removePinnedSiteUseCase: TopSitesUseCases.RemoveTopSiteUseCase =
|
||||
|
|
Loading…
Reference in New Issue