зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1408917 - Rename, refactor and enable browser_webconsole_autocomplete_JSTerm_helpers.js in new console frontend; r=Honza.
MozReview-Commit-ID: 3TN6q63mnHp --HG-- rename : devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_autocomplete_JSTerm_helpers.js => devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_autocomplete_helpers.js extra : rebase_source : 66a63445a74d1a069340c6be678408327b44d25d
This commit is contained in:
Родитель
7d07e76ce2
Коммит
3ce4a01fb7
|
@ -196,6 +196,7 @@ skip-if = true # Bug 1406060
|
|||
skip-if = true # Bug 1403188
|
||||
# old console skip-if = e10s # Bug 1042253 - webconsole e10s tests
|
||||
[browser_jsterm_add_edited_input_to_history.js]
|
||||
[browser_jsterm_autocomplete_helpers.js]
|
||||
[browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js]
|
||||
[browser_jsterm_copy_command.js]
|
||||
skip-if = true
|
||||
|
@ -214,8 +215,6 @@ skip-if = true # Bug 1403452
|
|||
# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
|
||||
[browser_webconsole_assert.js]
|
||||
skip-if = true # Bug 1403458
|
||||
[browser_webconsole_autocomplete_JSTerm_helpers.js]
|
||||
skip-if = true # Bug 1408917
|
||||
[browser_webconsole_autocomplete_accessibility.js]
|
||||
skip-if = true # Bug 1408918
|
||||
[browser_webconsole_autocomplete_and_selfxss.js]
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that the autocompletion results contain the names of JSTerm helpers.
|
||||
// See Bug 686937.
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test JSTerm Helpers autocomplete";
|
||||
|
||||
add_task(async function () {
|
||||
const {jsterm} = await openNewTabAndConsole(TEST_URI);
|
||||
await testInspectAutoCompletion(jsterm, "i", true);
|
||||
await testInspectAutoCompletion(jsterm, "window.", false);
|
||||
await testInspectAutoCompletion(jsterm, "dump(i", true);
|
||||
await testInspectAutoCompletion(jsterm, "window.dump(i", true);
|
||||
});
|
||||
|
||||
async function testInspectAutoCompletion(jsterm, inputValue, expectInspect) {
|
||||
jsterm.setInputValue(inputValue);
|
||||
await complete(jsterm);
|
||||
is(getPopupItemsLabel(jsterm.autocompletePopup).includes("inspect"), expectInspect,
|
||||
`autocomplete results${expectInspect ? "" : " does not"} contain helper 'inspect'`);
|
||||
}
|
||||
|
||||
function complete(jsterm) {
|
||||
const updated = jsterm.once("autocomplete-updated");
|
||||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
return updated;
|
||||
}
|
||||
|
||||
function getPopupItemsLabel(popup) {
|
||||
return popup.getItems().map(item => item.label);
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that the autocompletion results contain the names of JSTerm helpers.
|
||||
|
||||
"use strict";
|
||||
|
||||
// See Bug 686937.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>test JSTerm Helpers " +
|
||||
"autocomplete";
|
||||
|
||||
var jsterm;
|
||||
|
||||
add_task(function* () {
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
jsterm = hud.jsterm;
|
||||
let input = jsterm.inputNode;
|
||||
let popup = jsterm.autocompletePopup;
|
||||
|
||||
// Test if 'i' gives 'inspect'
|
||||
input.value = "i";
|
||||
input.setSelectionRange(1, 1);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
let newItems = popup.getItems().map(function (e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
// Test if 'window.' does not give 'inspect'.
|
||||
input.value = "window.";
|
||||
input.setSelectionRange(7, 7);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function (e) {
|
||||
return e.label;
|
||||
});
|
||||
is(newItems.indexOf("inspect"), -1,
|
||||
"autocomplete results do not contain helper 'inspect'");
|
||||
|
||||
// Test if 'dump(i' gives 'inspect'
|
||||
input.value = "dump(i";
|
||||
input.setSelectionRange(6, 6);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function (e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
// Test if 'window.dump(i' gives 'inspect'
|
||||
input.value = "window.dump(i";
|
||||
input.setSelectionRange(13, 13);
|
||||
yield complete(jsterm.COMPLETE_HINT_ONLY);
|
||||
|
||||
newItems = popup.getItems().map(function (e) {
|
||||
return e.label;
|
||||
});
|
||||
ok(newItems.indexOf("inspect") > -1,
|
||||
"autocomplete results contain helper 'inspect'");
|
||||
|
||||
jsterm = null;
|
||||
});
|
||||
|
||||
function complete(type) {
|
||||
let updated = jsterm.once("autocomplete-updated");
|
||||
jsterm.complete(type);
|
||||
return updated;
|
||||
}
|
Загрузка…
Ссылка в новой задаче