-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1909986 - For sidebar revamp, only show chatbot entrypoints (cont…
…ext menu, shortcuts) when tools include aichat r=tarek Convert existing entrypoint checks to getter that also checks sidebar. Differential Revision: https://phabricator.services.mozilla.com/D223690
- Loading branch information
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
browser/components/genai/tests/xpcshell/test_show_chat_entrypoint.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
const { GenAI } = ChromeUtils.importESModule( | ||
"resource:///modules/GenAI.sys.mjs" | ||
); | ||
|
||
registerCleanupFunction(() => { | ||
Services.prefs.clearUserPref("browser.ml.chat.enabled"); | ||
Services.prefs.clearUserPref("browser.ml.chat.provider"); | ||
Services.prefs.clearUserPref("sidebar.main.tools"); | ||
Services.prefs.clearUserPref("sidebar.revamp"); | ||
}); | ||
|
||
/** | ||
* Check various prefs for showing chat | ||
*/ | ||
add_task(async function test_show_chat() { | ||
Assert.ok(!GenAI.canShowChatEntrypoint, "Default no"); | ||
|
||
Services.prefs.setBoolPref("browser.ml.chat.enabled", true); | ||
|
||
Assert.ok(!GenAI.canShowChatEntrypoint, "Not enough to just enable"); | ||
|
||
Services.prefs.setStringPref( | ||
"browser.ml.chat.provider", | ||
"http://mochi.test:8888" | ||
); | ||
|
||
Assert.ok(GenAI.canShowChatEntrypoint, "Can show with provider"); | ||
|
||
Services.prefs.setBoolPref("sidebar.revamp", true); | ||
|
||
Assert.ok(GenAI.canShowChatEntrypoint, "Can show with revamp"); | ||
|
||
Services.prefs.setStringPref("sidebar.main.tools", "history"); | ||
|
||
Assert.ok(!GenAI.canShowChatEntrypoint, "Not shown without chatbot tool"); | ||
|
||
Services.prefs.setBoolPref("sidebar.revamp", false); | ||
|
||
Assert.ok(GenAI.canShowChatEntrypoint, "Ignore tools without revamp"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters