diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js')
-rw-r--r-- | devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js b/devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js new file mode 100644 index 000000000..03cdc2a4a --- /dev/null +++ b/devtools/client/sourceeditor/test/browser_editor_autocomplete_basic.js @@ -0,0 +1,59 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const AUTOCOMPLETION_PREF = "devtools.editor.autocomplete"; + +// Test to make sure that different autocompletion modes can be created, +// switched, and destroyed. This doesn't test the actual autocompletion +// popups, only their integration with the editor. +function test() { + waitForExplicitFinish(); + setup((ed, win) => { + let edWin = ed.container.contentWindow.wrappedJSObject; + testJS(ed, edWin); + testCSS(ed, edWin); + testPref(ed, edWin); + teardown(ed, win); + }); +} + +function testJS(ed, win) { + ok(!ed.getOption("autocomplete"), "Autocompletion is not set"); + ok(!win.tern, "Tern is not defined on the window"); + + ed.setMode(Editor.modes.js); + ed.setOption("autocomplete", true); + + ok(ed.getOption("autocomplete"), "Autocompletion is set"); + ok(win.tern, "Tern is defined on the window"); +} + +function testCSS(ed, win) { + ok(ed.getOption("autocomplete"), "Autocompletion is set"); + ok(win.tern, "Tern is currently defined on the window"); + + ed.setMode(Editor.modes.css); + ed.setOption("autocomplete", true); + + ok(ed.getOption("autocomplete"), "Autocompletion is still set"); + ok(!win.tern, "Tern is no longer defined on the window"); +} + +function testPref(ed, win) { + ed.setMode(Editor.modes.js); + ed.setOption("autocomplete", true); + + ok(ed.getOption("autocomplete"), "Autocompletion is set"); + ok(win.tern, "Tern is defined on the window"); + + info("Preffing autocompletion off"); + Services.prefs.setBoolPref(AUTOCOMPLETION_PREF, false); + + ok(ed.getOption("autocomplete"), "Autocompletion is still set"); + ok(!win.tern, "Tern is no longer defined on the window"); + + Services.prefs.clearUserPref(AUTOCOMPLETION_PREF); +} |