browser_styleeditor_autocomplete-disabled.js (1223B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // Test that autocomplete can be disabled. 6 7 const TESTCASE_URI = TEST_BASE_HTTP + "autocomplete.html"; 8 9 // Pref which decides if CSS autocompletion is enabled in Style Editor or not. 10 const AUTOCOMPLETION_PREF = "devtools.styleeditor.autocompletion-enabled"; 11 12 add_task(async function () { 13 const { ui } = await openStyleEditorForURL(TESTCASE_URI); 14 const editor = await ui.editors[0].getSourceEditor(); 15 editor.sourceEditor.setOption("autocomplete", false); 16 17 is( 18 editor.sourceEditor.getOption("autocomplete"), 19 false, 20 "Autocompletion option does not exist" 21 ); 22 ok( 23 !editor.sourceEditor.getAutocompletionPopup(), 24 "Autocompletion popup does not exist" 25 ); 26 }); 27 28 add_task(async function () { 29 Services.prefs.setBoolPref(AUTOCOMPLETION_PREF, false); 30 const { ui } = await openStyleEditorForURL(TESTCASE_URI); 31 const editor = await ui.editors[0].getSourceEditor(); 32 33 is( 34 editor.sourceEditor.getOption("autocomplete"), 35 false, 36 "Autocompletion option does not exist" 37 ); 38 }); 39 40 registerCleanupFunction(() => { 41 Services.prefs.clearUserPref(AUTOCOMPLETION_PREF); 42 });