browser_editor_disableSearchAddon.js (1073B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Ensure disableSearchAddon config works as expected in the source editor. 7 8 const isMacOS = Services.appinfo.OS === "Darwin"; 9 const L10N = new LocalizationHelper( 10 "devtools/client/locales/sourceeditor.properties" 11 ); 12 13 const FIND_KEY = L10N.getStr("find.key"); 14 const REPLACE_KEY = L10N.getStr( 15 isMacOS ? "replaceAllMac.key" : "replaceAll.key" 16 ); 17 18 add_task(async function () { 19 const { ed, win } = await setup({ 20 disableSearchAddon: true, 21 }); 22 23 const edDoc = ed.container.contentDocument; 24 const edWin = edDoc.defaultView; 25 26 await promiseWaitForFocus(); 27 ed.focus(); 28 29 synthesizeKeyShortcut(FIND_KEY, edWin); 30 const searchInput = edDoc.querySelector("input[type=search]"); 31 ok(!searchInput, "the search input is not displayed"); 32 33 synthesizeKeyShortcut(REPLACE_KEY, edWin); 34 const replaceInput = edDoc.querySelector(".CodeMirror-dialog > input"); 35 ok(!replaceInput, "the replace input is not displayed"); 36 37 teardown(ed, win); 38 });