зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1736937
- Add "Search bookmarks" option in bookmarks menu. r=dao
https://treeherder.mozilla.org/jobs?repo=try&revision=f1324632dfb7201ad71fddb074ec7e008c32d153 Differential Revision: https://phabricator.services.mozilla.com/D175604
This commit is contained in:
Родитель
62e4636c9a
Коммит
1c6c622a04
|
@ -625,6 +625,10 @@
|
|||
data-l10n-args='{ "isVisible": false }'
|
||||
oncommand="SidebarUI.toggle('viewBookmarksSidebar');"
|
||||
key="viewBookmarksSidebarKb"/>
|
||||
<menuitem id="BMB_searchBookmarks"
|
||||
class="subviewbutton"
|
||||
data-l10n-id="bookmarks-search"
|
||||
oncommand="PlacesCommandHook.searchBookmarks();"/>
|
||||
<!-- NB: temporary solution for bug 985024, this should go away soon. -->
|
||||
<menuitem id="BMB_bookmarksShowAllTop"
|
||||
class="subviewbutton"
|
||||
|
|
|
@ -27,6 +27,7 @@ support-files =
|
|||
add_search_engine_two.html
|
||||
[browser_click_row_border.js]
|
||||
[browser_contextualsearch.js]
|
||||
[browser_search_bookmarks_from_bookmarks_menu.js]
|
||||
[browser_shortcuts_add_search_engine.js]
|
||||
support-files =
|
||||
add_search_engine_many.html
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function searchBookmarksFromBooksmarksMenu() {
|
||||
// Add Button to toolbar
|
||||
CustomizableUI.addWidgetToArea(
|
||||
"bookmarks-menu-button",
|
||||
CustomizableUI.AREA_NAVBAR,
|
||||
0
|
||||
);
|
||||
let bookmarksMenuButton = document.getElementById("bookmarks-menu-button");
|
||||
ok(bookmarksMenuButton, "Bookmarks Menu Button added");
|
||||
|
||||
// Open Bookmarks-Menu-Popup
|
||||
let bookmarksMenuPopup = document.getElementById("BMB_bookmarksPopup");
|
||||
let PopupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
bookmarksMenuPopup,
|
||||
"popupshown"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(bookmarksMenuButton, {
|
||||
type: "mousedown",
|
||||
});
|
||||
await PopupShownPromise;
|
||||
ok(true, "Bookmarks Menu Popup shown");
|
||||
|
||||
// Click on 'Search Bookmarks'
|
||||
let searchBookmarksButton = document.getElementById("BMB_searchBookmarks");
|
||||
ok(
|
||||
BrowserTestUtils.is_visible(
|
||||
searchBookmarksButton,
|
||||
"'Search Bookmarks Button' is visible."
|
||||
)
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(searchBookmarksButton, {});
|
||||
|
||||
await new Promise(resolve => {
|
||||
window.gURLBar.controller.addQueryListener({
|
||||
onViewOpen() {
|
||||
window.gURLBar.controller.removeQueryListener(this);
|
||||
resolve();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Verify URLBar is in search mode with correct restriction
|
||||
is(
|
||||
gURLBar.searchMode?.source,
|
||||
UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
|
||||
"Addressbar in correct mode."
|
||||
);
|
||||
|
||||
CustomizableUI.reset();
|
||||
});
|
Загрузка…
Ссылка в новой задаче