Bug 1465149 - Remove old jsterm code. r=jdescottes.

Since we modified the Editor to be accessible, we got
the green light to remove the old JsTerm code.
This means we can remove the preference for the codeMirror
input, and clean the WebConsole react app a bit.
This also mean we can avoid running a lot of our tests
twice.
Finally, some test helpers had to take argument with
specific shape to work against old jsterm (e.g. checkInputCompletionValue),
that we can now remove to make tests easier to read.

Differential Revision: https://phabricator.services.mozilla.com/D40172

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-08-04 09:38:25 +00:00
Родитель 293c2668b6
Коммит 1aeeaf2559
101 изменённых файлов: 554 добавлений и 2225 удалений

Просмотреть файл

@ -285,9 +285,6 @@ pref("devtools.webconsole.sidebarToggle", true);
pref("devtools.webconsole.sidebarToggle", false);
#endif
// Enable CodeMirror in the JsTerm
pref("devtools.webconsole.jsterm.codeMirror", true);
// Enable editor mode in the console in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.webconsole.features.editor", true);

Просмотреть файл

@ -459,8 +459,6 @@ a {
}
/* JSTerm Styles */
html .jsterm-input-node-html,
html #webconsole-notificationbox {
flex: 0;
width: 100%;
@ -478,54 +476,8 @@ html #webconsole-notificationbox {
position: relative;
}
.jsterm-input-node {
box-sizing: border-box;
min-height: 100%;
color: var(--theme-text-color-strong);
/* input icon */
background-image: url(chrome://devtools/skin/images/webconsole/input.svg);
background-position-x: calc(10px + var(--console-icon-horizontal-offset));
background-position-y: 7px;
background-repeat: no-repeat;
background-size: 12px 12px;
-moz-context-properties: fill;
fill: var(--theme-icon-dimmed-color);
}
.jsterm-complete-node {
color: var(--theme-comment);
}
textarea.jsterm-input-node,
textarea.jsterm-complete-node {
width: 100%;
margin: 0;
border: none;
background-color: transparent;
resize: none;
font-size: inherit;
line-height: 16px;
overflow-x: hidden;
padding: 5px 0;
padding-inline-start: var(--console-inline-start-gutter);
}
textarea.jsterm-complete-node {
position: absolute;
top: 0;
left: 0;
height: 100%;
pointer-events: none;
}
textarea.jsterm-input-node:focus {
fill: var(--theme-icon-checked-color);
box-shadow: none;
outline: none;
}
/* CodeMirror-powered JsTerm */
.jsterm-cm .jsterm-input-container > .CodeMirror {
.webconsole-app .jsterm-input-container > .CodeMirror {
font-size: var(--theme-code-font-size);
line-height: var(--console-output-line-height);
/* aim for a 32px left space (a descendent has 4px padding) */
@ -540,11 +492,11 @@ textarea.jsterm-input-node:focus {
fill: var(--theme-icon-dimmed-color);
}
.jsterm-cm .jsterm-input-container > .CodeMirror-focused {
.webconsole-app .jsterm-input-container > .CodeMirror-focused {
fill: var(--theme-icon-checked-color);
}
.jsterm-cm .cm-auto-complete-shadow-text::after {
.webconsole-app .cm-auto-complete-shadow-text::after {
content: attr(title);
color: var(--theme-comment);
/* This is important for the completion text not to move while the user is typing */
@ -552,7 +504,7 @@ textarea.jsterm-input-node:focus {
position: absolute;
}
.jsterm-cm .CodeMirror-hscrollbar {
.webconsole-app .CodeMirror-hscrollbar {
/* We never want to see the horizontal scrollbar */
display: none !important;
}

Просмотреть файл

@ -103,6 +103,7 @@ body {
.webconsole-app .jsterm-input-container {
min-height: 28px;
padding-block-start: 2px;
overflow-y: auto;
overflow-x: hidden;
flex-grow: 1;
@ -113,8 +114,8 @@ body {
grid-auto-flow: column;
}
.jsterm-cm .jsterm-input-container {
padding-block-start: 2px;
.webconsole-app .webconsole-output:empty ~ .jsterm-input-container {
border-top: none;
}
.webconsole-input-openEditorButton {
@ -127,10 +128,6 @@ body {
background-image: url("chrome://devtools/skin/images/webconsole/editor.svg");
}
.webconsole-app .webconsole-output:empty ~ .jsterm-input-container {
border-top: none;
}
.reverse-search {
grid-column: 1 / 2;
grid-row: -1 / -2;
@ -290,7 +287,7 @@ body {
grid-column: -1 / 1;
}
.jsterm-cm.jsterm-editor .jsterm-input-container > .CodeMirror {
.jsterm-editor .jsterm-input-container > .CodeMirror {
padding-inline-start: 0;
background-image: none;
}

Просмотреть файл

@ -79,7 +79,6 @@ class App extends Component {
onFirstMeaningfulPaint: PropTypes.func.isRequired,
serviceContainer: PropTypes.object.isRequired,
closeSplitConsole: PropTypes.func.isRequired,
jstermCodeMirror: PropTypes.bool,
autocomplete: PropTypes.bool,
currentReverseSearchEntry: PropTypes.string,
reverseSearchInputVisible: PropTypes.bool,
@ -275,7 +274,6 @@ class App extends Component {
const {
webConsoleUI,
serviceContainer,
jstermCodeMirror,
autocomplete,
editorMode,
editorWidth,
@ -287,7 +285,6 @@ class App extends Component {
webConsoleUI,
serviceContainer,
onPaste: this.onPaste,
codeMirrorEnabled: jstermCodeMirror,
autocomplete,
editorMode: editorMode && editorFeatureEnabled,
editorWidth,
@ -329,26 +326,22 @@ class App extends Component {
}
renderConfirmDialog() {
const { webConsoleUI, serviceContainer, jstermCodeMirror } = this.props;
const { webConsoleUI, serviceContainer } = this.props;
return ConfirmDialog({
webConsoleUI,
serviceContainer,
codeMirrorEnabled: jstermCodeMirror,
key: "confirm-dialog",
});
}
renderRootElement(children) {
const { jstermCodeMirror, editorMode, editorFeatureEnabled } = this.props;
const { editorMode, editorFeatureEnabled } = this.props;
const classNames = ["webconsole-app"];
if (editorMode && editorFeatureEnabled) {
classNames.push("jsterm-editor");
}
if (jstermCodeMirror) {
classNames.push("jsterm-cm");
}
return div(
{

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -82,7 +82,6 @@ const prefs = {
FEATURES: {
// We use the same pref to enable the sidebar on webconsole and browser console.
SIDEBAR_TOGGLE: "devtools.webconsole.sidebarToggle",
JSTERM_CODE_MIRROR: "devtools.webconsole.jsterm.codeMirror",
AUTOCOMPLETE: "devtools.webconsole.input.autocomplete",
GROUP_WARNINGS: "devtools.webconsole.groupWarningMessages",
EDITOR: "devtools.webconsole.features.editor",

Просмотреть файл

@ -15,7 +15,6 @@ const PrefState = overrides =>
{
logLimit: 1000,
sidebarToggle: false,
jstermCodeMirror: false,
groupWarnings: false,
historyCount: 50,
editor: false,

Просмотреть файл

@ -45,7 +45,6 @@ function configureStore(webConsoleUI, options = {}) {
const logLimit =
options.logLimit || Math.max(getIntPref("devtools.hud.loglimit"), 1);
const sidebarToggle = getBoolPref(PREFS.FEATURES.SIDEBAR_TOGGLE);
const jstermCodeMirror = getBoolPref(PREFS.FEATURES.JSTERM_CODE_MIRROR);
const autocomplete = getBoolPref(PREFS.FEATURES.AUTOCOMPLETE);
const groupWarnings = getBoolPref(PREFS.FEATURES.GROUP_WARNINGS);
const editor = getBoolPref(PREFS.FEATURES.EDITOR);
@ -55,7 +54,6 @@ function configureStore(webConsoleUI, options = {}) {
prefs: PrefState({
logLimit,
sidebarToggle,
jstermCodeMirror,
autocomplete,
historyCount,
groupWarnings,

Просмотреть файл

@ -23,7 +23,6 @@ pref("devtools.webconsole.inputHistoryCount", 300);
pref("devtools.webconsole.persistlog", false);
pref("devtools.webconsole.timestampMessages", false);
pref("devtools.webconsole.sidebarToggle", true);
pref("devtools.webconsole.jsterm.codeMirror", true);
pref("devtools.webconsole.groupWarningMessages", false);
pref("devtools.webconsole.input.editor", false);
pref("devtools.webconsole.input.autocomplete", true);

Просмотреть файл

@ -175,7 +175,6 @@ skip-if = verify
[browser_console_webconsole_ctrlw_close_tab.js]
[browser_console_webconsole_iframe_messages.js]
[browser_console_webconsole_private_browsing.js]
[browser_jsterm_accessibility.js]
[browser_jsterm_add_edited_input_to_history.js]
[browser_jsterm_autocomplete_accept_no_scroll.js]
[browser_jsterm_autocomplete_array_no_index.js]

Просмотреть файл

@ -16,15 +16,6 @@ add_task(async function() {
// This is required for testing the text input in the browser console:
await pushPref("devtools.chrome.enabled", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
await addTab(TEST_URI);
const hud = await HUDService.toggleBrowserConsole();
@ -79,10 +70,7 @@ async function performTests() {
"The context menu has the expected entries for a simple log message"
);
menuPopup = await openContextMenu(
hud,
hud.jsterm.node || hud.jsterm.inputNode
);
menuPopup = await openContextMenu(hud, hud.jsterm.node);
let actualEntries = getL10NContextMenu(menuPopup);
is(
@ -99,7 +87,7 @@ async function performTests() {
is(actualEntries[4], "#editmenu-delete (editmenu-delete) [disabled]");
is(actualEntries[5], "#editmenu-selectAll (editmenu-select-all) [disabled]");
const node = hud.jsterm.inputNode || hud.jsterm.node;
const node = hud.jsterm.node;
const inputContainer = node.closest(".jsterm-input-container");
await openContextMenu(hud, inputContainer);
@ -121,7 +109,7 @@ async function performTests() {
await hideContextMenu(hud);
// Close the browser console.
await HUDService.toggleBrowserConsole();
}
});
function addPrefBasedEntries(expectedEntries) {
if (Services.prefs.getBoolPref("devtools.webconsole.sidebarToggle", false)) {

Просмотреть файл

@ -13,15 +13,6 @@ add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
await addTab(TEST_URI);
const hud = await HUDService.toggleBrowserConsole();
@ -50,4 +41,4 @@ async function performTests() {
info("Close the Browser console");
await HUDService.toggleBrowserConsole();
}
});

Просмотреть файл

@ -1,92 +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 autocomplete input is being blurred and focused when selecting a value.
// This will help screen-readers notify users of the value that was set in the input.
"use strict";
const TEST_URI = "data:text/html;charset=utf8,<p>test code completion";
add_task(async function() {
// Only run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
const { jsterm } = await openNewTabAndConsole(TEST_URI);
const input = jsterm.inputNode;
info("Test that the console input is not treated as a live region");
ok(
!isElementInLiveRegion(input),
"Console input is not treated as a live region"
);
info("Test the console input has no aria-activedescendant attribute");
ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant");
info("Type 'd' to open the autocomplete popup");
const { autocompletePopup } = jsterm;
const onPopupOpen = autocompletePopup.once("popup-opened");
EventUtils.sendString("d");
await onPopupOpen;
ok(
autocompletePopup.isOpen && autocompletePopup.itemCount > 0,
"Autocomplete popup is open and contains suggestions"
);
info("Test the console input has an aria-activedescendant attribute");
ok(input.hasAttribute("aria-activedescendant"), "aria-activedescendant");
// Add listeners for focus and blur events.
let wasBlurred = false;
input.addEventListener(
"blur",
() => {
wasBlurred = true;
},
{
once: true,
}
);
let wasFocused = false;
input.addEventListener(
"focus",
() => {
ok(
wasBlurred,
"jsterm input received a blur event before received back the focus"
);
wasFocused = true;
},
{
once: true,
}
);
info("Close the autocomplete popup by simulating a TAB key event");
const onPopupClosed = jsterm.autocompletePopup.once("popup-closed");
EventUtils.synthesizeKey("KEY_Tab");
info("Wait for the autocomplete popup to be closed");
await onPopupClosed;
ok(wasFocused, "jsterm input received a focus event");
info("Test the console input has no aria-activedescendant attribute no more");
ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant");
});
function isElementInLiveRegion(element) {
if (!element) {
return false;
}
if (element.hasAttribute("aria-live")) {
return element.getAttribute("aria-live") !== "off";
}
return isElementInLiveRegion(element.parentNode);
}

Просмотреть файл

@ -12,15 +12,6 @@
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 817834";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
ok(!getInputValue(hud), "console input is empty");
@ -87,4 +78,4 @@ async function performTests() {
'"first item"',
"test history up reaches the previous value"
);
}
});

Просмотреть файл

@ -10,15 +10,6 @@
const TEST_URI = `data:text/html;charset=utf8,test autocompletion with $ or _`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
execute(hud, "var testObject = {$$aaab: '', $$aaac: ''}");
@ -37,7 +28,7 @@ async function performTests() {
await testAutocomplete(hud, "blargh");
await testAutocomplete(hud, "foobar.a");
await testAutocomplete(hud, "blargh.a");
}
});
async function testAutocomplete(hud, inputString) {
await setInputValueForAutocompletion(hud, inputString);

Просмотреть файл

@ -19,9 +19,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
</script>`;
add_task(async function() {
// Only run test with legacy JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm, ui } = hud;
const { autocompletePopup: popup } = jsterm;
@ -35,12 +32,10 @@ add_task(async function() {
EventUtils.sendString("window.foobar.");
await onPopUpOpen;
const scrollableEl = ui.window.document.querySelector(".CodeMirror-scroll");
const inputContainer = ui.window.document.querySelector(
".jsterm-input-container"
);
ok(inputContainer.scrollTop > 0, "The input overflows");
const scrollTop = inputContainer.scrollTop;
ok(scrollableEl.scrollTop > 0, "The input overflows");
const scrollTop = scrollableEl.scrollTop;
info("Hit Enter to accept the autocompletion");
const onPopupClose = popup.once("popup-closed");
@ -54,7 +49,7 @@ add_task(async function() {
"completion was successful after KEY_Enter"
);
is(
inputContainer.scrollTop,
scrollableEl.scrollTop,
scrollTop,
"The scrolling position stayed the same when accepting the completion"
);

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 585991 - Autocomplete popup on array</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { autocompletePopup: popup } = hud.jsterm;
@ -48,4 +39,4 @@ async function performTests() {
EventUtils.synthesizeKey("KEY_Escape");
await onPopupClose;
}
});

Просмотреть файл

@ -17,20 +17,11 @@ const TEST_URI = `data:text/html;charset=utf-8,<head><script>
</script></head><body>Autocomplete text navigation key usage test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests(true);
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests(oldJsterm) {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup: popup } = jsterm;
await checkWordNavigation(hud, oldJsterm);
await checkWordNavigation(hud);
await checkArrowLeftDismissPopup(hud);
await checkArrowLeftDismissCompletion(hud);
await checkArrowRightAcceptCompletion(hud);
@ -52,7 +43,7 @@ async function performTests(oldJsterm) {
});
await onPopUpClose;
is(getInputValue(hud), "win.", "input value wasn't modified");
}
});
async function checkArrowLeftDismissPopup(hud) {
const popup = hud.jsterm.autocompletePopup;
@ -94,11 +85,7 @@ async function checkArrowLeftDismissPopup(hud) {
// checkInput is asserting the cursor position with the "|" char.
checkInputValueAndCursorPosition(hud, "window.foo.bb|");
is(popup.isOpen, true, "popup is open");
checkInputCompletionValue(
hud,
" b",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "b", "completeNode has expected value");
const { keyOption, expectedInput } = test;
info(`Test that arrow left closes the popup and clears complete node`);
@ -145,12 +132,7 @@ async function checkArrowLeftDismissCompletion(hud) {
for (const test of tests) {
await setInputValueForAutocompletion(hud, "window.foo.a");
const prefix = getInputValue(hud).replace(/[\S]/g, " ");
checkInputCompletionValue(
hud,
prefix + "a",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "a", "completeNode has expected value");
info(`Test that arrow left dismiss the completion text`);
const { keyOption, expectedInput } = test;
@ -197,11 +179,7 @@ async function checkArrowRightAcceptCompletion(hud) {
// checkInput is asserting the cursor position with the "|" char.
checkInputValueAndCursorPosition(hud, `window.foo.bb|`);
is(popup.isOpen, true, "popup is open");
checkInputCompletionValue(
hud,
" b",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "b", "completeNode has expected value");
const { keyOption } = test;
info(`Test that arrow right closes the popup and accepts the completion`);
@ -216,13 +194,12 @@ async function checkArrowRightAcceptCompletion(hud) {
setInputValue(hud, "");
}
async function checkWordNavigation(hud, oldJsterm) {
async function checkWordNavigation(hud) {
const accelKey = Services.appinfo.OS == "Darwin" ? "altKey" : "ctrlKey";
const goLeft = () =>
EventUtils.synthesizeKey("KEY_ArrowLeft", { [accelKey]: true });
const goRight = () =>
EventUtils.synthesizeKey("KEY_ArrowRight", { [accelKey]: true });
const isWindowsAndOldJsTerm = Services.appinfo.OS == "WINNT" && oldJsterm;
setInputValue(hud, "aa bb cc dd");
checkInputValueAndCursorPosition(hud, "aa bb cc dd|");
@ -247,16 +224,13 @@ async function checkWordNavigation(hud, oldJsterm) {
goRight();
// Windows differ from other platforms, going to the start of the next string.
let expectedInput = isWindowsAndOldJsTerm ? "aa |bb cc dd" : "aa| bb cc dd";
checkInputValueAndCursorPosition(hud, expectedInput);
checkInputValueAndCursorPosition(hud, "aa| bb cc dd");
goRight();
expectedInput = isWindowsAndOldJsTerm ? "aa bb |cc dd" : "aa bb| cc dd";
checkInputValueAndCursorPosition(hud, expectedInput);
checkInputValueAndCursorPosition(hud, "aa bb| cc dd");
goRight();
expectedInput = isWindowsAndOldJsTerm ? "aa bb cc |dd" : "aa bb cc| dd";
checkInputValueAndCursorPosition(hud, expectedInput);
checkInputValueAndCursorPosition(hud, "aa bb cc| dd");
goRight();
checkInputValueAndCursorPosition(hud, "aa bb cc dd|");

Просмотреть файл

@ -10,22 +10,13 @@
const TEST_URI = `data:text/html;charset=utf-8,Autocomplete await expression`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
info("Check that the await keyword is in the autocomplete");
await setInputValueForAutocompletion(hud, "aw");
checkInputCompletionValue(hud, " ait", "completeNode has expected value");
checkInputCompletionValue(hud, "ait", "completeNode has expected value");
EventUtils.synthesizeKey("KEY_Tab");
is(getInputValue(hud), "await", "'await' tab completion");
@ -44,4 +35,4 @@ async function performTests() {
autocompletePopup.items.some(item => item.label === "Promise"),
"popup has expected `Promise` item"
);
}
});

Просмотреть файл

@ -12,15 +12,6 @@ const TEST_URI =
"data:text/html;charset=utf8,<p>test cached autocompletion results";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup: popup } = jsterm;
@ -31,11 +22,7 @@ async function performTests() {
// Test if 'doc' gives 'document'
await jstermComplete("doc");
is(getInputValue(hud), "doc", "'docu' completion (input.value)");
checkInputCompletionValue(
hud,
" ument",
"'docu' completion (completeNode)"
);
checkInputCompletionValue(hud, "ument", "'docu' completion (completeNode)");
// Test typing 'window.'.'
await jstermComplete("window.");
@ -146,7 +133,7 @@ async function performTests() {
"zzz-zzzz",
"filtering from the cache works - step 2"
);
}
});
function getPopupLabels(popup) {
return popup.getItems().map(item => item.label);

Просмотреть файл

@ -8,15 +8,6 @@
const TEST_URI = `data:text/html;charset=utf-8,Test command autocomplete`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -41,7 +32,7 @@ async function performTests() {
await onAutocompleUpdated;
checkInputCompletionValue(
hud,
" creenshot",
"creenshot",
"completion node has expected :screenshot value"
);
@ -64,13 +55,13 @@ async function performTests() {
await onAutocompleUpdated;
checkInputCompletionValue(
hud,
" p",
"p",
"completion node has expected :help value"
);
EventUtils.synthesizeKey("KEY_Tab");
is(getInputValue(hud), ":help", "Tab key correctly completes :help");
}
});
function getPopupItems(popup) {
return popup.items.map(item => item.label);

Просмотреть файл

@ -21,15 +21,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 585991 - autocomplete popup ctrl+space usage test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
// await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
info("web console opened");
@ -65,4 +56,4 @@ async function performTests() {
ok(popup.isOpen, "popup opens on Ctrl+Space");
is(popup.itemCount, itemCount, "popup has the expected items");
}
});

Просмотреть файл

@ -11,15 +11,6 @@ const TEST_URI =
"test/mochitest/test-iframe-parent.html";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
await executeAndWaitForMessage(
@ -52,4 +43,4 @@ async function performTests() {
".result"
);
ok(true, "root document's location is accessible");
}
});

Просмотреть файл

@ -23,15 +23,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 585991 - autocomplete popup escape key usage test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
info("web console opened");
@ -58,4 +49,4 @@ async function performTests() {
ok(!popup.isOpen, "popup is not open after VK_ESCAPE");
is(getInputValue(hud), "window.foo.", "completion was cancelled");
ok(!getInputCompletionValue(hud), "completeNode is empty");
}
});

Просмотреть файл

@ -11,15 +11,6 @@
const TEST_URI = "data:text/html;charset=utf-8,test for bug 592442";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
try {
@ -28,4 +19,4 @@ async function performTests() {
} catch (ex) {
ok(false, "an error was thrown when an extraneous bracket was inserted");
}
}
});

Просмотреть файл

@ -30,15 +30,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>Autocomplete popup - invoke getter cache test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -135,4 +126,4 @@ async function performTests() {
info("Close tooltip");
EventUtils.synthesizeKey("KEY_Escape");
await waitFor(() => !isConfirmDialogOpened(toolbox));
}
});

Просмотреть файл

@ -18,15 +18,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>Autocomplete popup - invoke getter - close dialog test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const target = await TargetFactory.forTab(gBrowser.selectedTab);
@ -87,4 +78,4 @@ async function performTests() {
true,
"The tooltip is now closed since the input doesn't match a getter name"
);
}
});

Просмотреть файл

@ -34,15 +34,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>Autocomplete popup - invoke getter usage test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -153,4 +144,4 @@ async function performTests() {
);
checkInputValueAndCursorPosition(hud, "window.foo.rab.|");
is(isConfirmDialogOpened(toolbox), false, "confirm tooltip is now closed");
}
});

Просмотреть файл

@ -25,15 +25,6 @@ const MDN_URL =
"https://developer.mozilla.org/docs/Tools/Web_Console/Invoke_getters_from_autocomplete";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = gDevTools.getToolbox(target);
@ -66,4 +57,4 @@ async function performTests() {
info("Close the popup");
EventUtils.synthesizeKey("KEY_Escape");
await waitFor(() => !isConfirmDialogOpened(toolbox));
}
});

Просмотреть файл

@ -12,21 +12,12 @@ const TEST_URI =
"data:text/html;charset=utf8,<p>test JSTerm Helpers autocomplete";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
await testInspectAutoCompletion(hud, "i", true);
await testInspectAutoCompletion(hud, "window.", false);
await testInspectAutoCompletion(hud, "dump(i", true);
await testInspectAutoCompletion(hud, "window.dump(i", true);
}
});
async function testInspectAutoCompletion(hud, inputValue, expectInspect) {
setInputValue(hud, "");

Просмотреть файл

@ -8,15 +8,6 @@
"use strict";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole("about:config");
ok(hud, "we have a console");
ok(hud.iframeWindow, "we have the console UI window");
@ -27,5 +18,5 @@ async function performTests() {
// Test typing 'docu'.
await setInputValueForAutocompletion(hud, "docu");
checkInputCompletionValue(hud, " ment", "'docu' completion");
}
checkInputCompletionValue(hud, "ment", "'docu' completion");
});

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI =
requestLongerTimeout(20);
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup: popup } = jsterm;
@ -56,7 +47,7 @@ async function performTests() {
// Test if 'foo1Obj.' gives 'prop1' and 'prop2'
await jstermComplete("foo1Obj.");
checkInputCompletionValue(hud, " prop1", "foo1Obj completion");
checkInputCompletionValue(hud, "prop1", "foo1Obj completion");
is(
getPopupLabels(popup).join("-"),
"prop1-prop2",
@ -125,7 +116,7 @@ async function performTests() {
// Test if 'foo2Obj[0].' throws no errors.
await jstermComplete("foo2Obj[0].");
is(getPopupLabels(popup).length, 0, "no items for foo2Obj[0]");
}
});
function getPopupLabels(popup) {
return popup.getItems().map(item => item.label);

Просмотреть файл

@ -23,15 +23,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 812618 - test completion inside text</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
info("web console opened");
@ -155,7 +146,7 @@ async function performTests() {
is(getInputValue(hud), "9t9luftballons", "jsterm has expected value");
is(popup.isOpen, false, "popup is not open");
ok(!getInputCompletionValue(hud), "there is no completion text");
}
});
async function setInitialState(hud) {
const { jsterm } = hud;

Просмотреть файл

@ -12,15 +12,6 @@ const TEST_URI =
"data:text/html;charset=utf-8,Test document.body autocompletion";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm, ui } = hud;
@ -60,15 +51,5 @@ async function performTests() {
EventUtils.sendString("o");
await onAutoCompleteUpdated;
// Build the spaces that are placed in the input to place the autocompletion result at
// the expected spot:
// > document.bo <-- input
// > -----------dy <-- autocomplete
const spaces = " ".repeat(inputStr.length + 1);
checkInputCompletionValue(
hud,
spaces + "dy",
"autocomplete shows document.body"
);
}
checkInputCompletionValue(hud, "dy", "autocomplete shows document.body");
});

Просмотреть файл

@ -24,15 +24,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 585991 - autocomplete popup navigation and tab key usage test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
info("web console opened");
@ -63,34 +54,21 @@ async function performTests() {
EventUtils.synthesizeKey("KEY_ArrowUp");
let prefix = getInputValue(hud).replace(/[\S]/g, " ");
is(popup.selectedIndex, 3, "index 3 is selected");
is(popup.selectedItem.label, "item3", "item3 is selected");
checkInputCompletionValue(
hud,
prefix + "item3",
"completeNode.value holds item3"
);
checkInputCompletionValue(hud, "item3", "completeNode.value holds item3");
EventUtils.synthesizeKey("KEY_ArrowUp");
is(popup.selectedIndex, 2, "index 2 is selected");
is(popup.selectedItem.label, "item2", "item2 is selected");
checkInputCompletionValue(
hud,
prefix + "item2",
"completeNode.value holds item2"
);
checkInputCompletionValue(hud, "item2", "completeNode.value holds item2");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(popup.selectedIndex, 3, "index 3 is selected");
is(popup.selectedItem.label, "item3", "item3 is selected");
checkInputCompletionValue(
hud,
prefix + "item3",
"completeNode.value holds item3"
);
checkInputCompletionValue(hud, "item3", "completeNode.value holds item3");
let currentSelectionIndex = popup.selectedIndex;
@ -136,12 +114,7 @@ async function performTests() {
"Check that hitting Home hides the completion text when the popup is hidden"
);
await setInputValueForAutocompletion(hud, "window.foo.item0");
prefix = getInputValue(hud).replace(/[\S]/g, " ");
checkInputCompletionValue(
hud,
prefix + "0",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "0", "completeNode has expected value");
if (Services.appinfo.OS == "Darwin") {
EventUtils.synthesizeKey("a", { ctrlKey: true });
} else {
@ -157,16 +130,11 @@ async function performTests() {
"Check that hitting End hides the completion text when the popup is hidden"
);
await setInputValueForAutocompletion(hud, "window.foo.item0");
prefix = getInputValue(hud).replace(/[\S]/g, " ");
checkInputCompletionValue(
hud,
prefix + "0",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "0", "completeNode has expected value");
EventUtils.synthesizeKey("KEY_End");
checkInputCompletionValue(
hud,
"",
"completeNode was cleared after hitting End"
);
}
});

Просмотреть файл

@ -16,15 +16,6 @@ XPCOMUtils.defineLazyServiceGetter(
const stringToCopy = "foobazbarBug642615";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm, ui } = hud;
ui.clearOutput();
@ -74,4 +65,4 @@ async function performTests() {
await onAutocompleteUpdated;
ok(!getInputCompletionValue(hud), "no completion value after paste (ctrl-v)");
}
});

Просмотреть файл

@ -26,15 +26,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>bug 585991 - test pressing return with open popup</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup: popup } = jsterm;
@ -62,12 +53,7 @@ async function performTests() {
"last index is selected"
);
is(popup.selectedItem.label, "item33", "item33 is selected");
const prefix = getInputValue(hud).replace(/[\S]/g, " ");
checkInputCompletionValue(
hud,
prefix + "item33",
"completeNode.value holds item33"
);
checkInputCompletionValue(hud, "item33", "completeNode.value holds item33");
info("press Return to accept suggestion. wait for popup to hide");
let onPopupClose = popup.once("popup-closed");
@ -105,4 +91,4 @@ async function performTests() {
"window.foobar.item3",
"completion was successful after KEY_Enter"
);
}
});

Просмотреть файл

@ -21,15 +21,6 @@ const {
} = require("devtools/client/webconsole/selectors/history");
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm, ui } = hud;
@ -74,4 +65,4 @@ async function performTests() {
info("Wait for the execution value to appear");
await onMessage;
}
});

Просмотреть файл

@ -23,14 +23,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>Test</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const { jsterm } = await openNewTabAndConsole(TEST_URI);
const { autocompletePopup: popup } = jsterm;
@ -83,4 +75,4 @@ async function performTests() {
originalWidth,
"popup is back to its original width"
);
}
});

Просмотреть файл

@ -22,15 +22,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
<body>Test autocomplete close on content navigation</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
info("web console opened");
@ -56,4 +47,4 @@ async function performTests() {
ok(!popup.isOpen, "popup is not open after reloading the page");
is(getInputValue(hud), "window.foo.", "completion was cancelled");
ok(!getInputCompletionValue(hud), "completeNode is empty");
}
});

Просмотреть файл

@ -12,15 +12,6 @@ add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const executeAndWaitForResultMessage = (input, expectedOutput) =>
@ -73,4 +64,4 @@ async function performTests() {
`Promise {`
);
ok(message, "Promise are displayed as expected");
}
});

Просмотреть файл

@ -11,16 +11,6 @@ const TEST_URI =
add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Check that declaring a let variable does not create a global property");
@ -80,7 +70,7 @@ async function performTests() {
await checkVariable(hud, "bazI");
await checkVariable(hud, "bazJ");
await checkVariable(hud, "bazK");
}
});
async function checkVariable(hud, varName) {
await executeAndWaitForMessage(

Просмотреть файл

@ -11,16 +11,6 @@ const TEST_URI =
add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
hud.ui.clearOutput();
@ -55,4 +45,4 @@ async function performTests() {
JSON.stringify(expectedMessages, null, 2),
"The output contains the the expected messages, in the expected order"
);
}
});

Просмотреть файл

@ -14,15 +14,6 @@ add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const executeAndWaitForResultMessage = (input, expectedOutput) =>
@ -44,4 +35,4 @@ async function performTests() {
`;
await executeAndWaitForResultMessage(importAwaitExpression, `2 + 3 + 4 = 9`);
ok(true, "The `sum` module was imported and used successfully a second time");
}
});

Просмотреть файл

@ -11,16 +11,6 @@ const TEST_URI =
add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const executeAndWaitForErrorMessage = (input, expectedOutput) =>
@ -127,4 +117,4 @@ async function performTests() {
res.node,
"awaiting for a malformed expression displays a meaningful error"
);
}
});

Просмотреть файл

@ -11,16 +11,6 @@ const TEST_URI = "data:text/html;charset=utf-8,top-level await + $_";
add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const executeAndWaitForResultMessage = (input, expectedOutput) =>
@ -90,4 +80,4 @@ async function performTests() {
true,
"$_ was replaced with the last resolving top-level await evaluation result"
);
}
});

Просмотреть файл

@ -11,15 +11,6 @@ add_task(async function() {
// Enable await mapping.
await pushPref("devtools.debugger.features.map-await-expression", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
// Force the split console to be closed.
await pushPref("devtools.toolbox.splitconsoleEnabled", false);
const hud = await openNewTabAndConsole(TEST_URI);
@ -81,4 +72,4 @@ async function performTests() {
JSON.stringify(expectedMessages, null, 2),
"The output contains the the expected messages, in the expected order"
);
}
});

Просмотреть файл

@ -13,15 +13,6 @@ const TEST_URI = `data:text/html;charset=utf8,<p>test code completion
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm, ui } = hud;
const { autocompletePopup } = jsterm;
@ -29,7 +20,7 @@ async function performTests() {
// Test typing 'docu'.
await setInputValueForAutocompletion(hud, "foob");
is(getInputValue(hud), "foob", "'foob' completion (input.value)");
checkInputCompletionValue(hud, " ar", "'foob' completion (completeNode)");
checkInputCompletionValue(hud, "ar", "'foob' completion (completeNode)");
is(autocompletePopup.items.length, 1, "autocomplete popup has 1 item");
is(autocompletePopup.isOpen, false, "autocomplete popup is not open");
@ -54,11 +45,7 @@ async function performTests() {
const onPopupOpened = autocompletePopup.once("popup-opened");
await setInputValueForAutocompletion(hud, "document.getElem");
is(getInputValue(hud), "document.getElem", "'document.getElem' completion");
checkInputCompletionValue(
hud,
" entById",
"'document.getElem' completion"
);
checkInputCompletionValue(hud, "entById", "'document.getElem' completion");
// Test pressing key down.
await onPopupOpened;
@ -66,7 +53,7 @@ async function performTests() {
is(getInputValue(hud), "document.getElem", "'document.getElem' completion");
checkInputCompletionValue(
hud,
" entsByClassName",
"entsByClassName",
"'document.getElem' another tab completion"
);
@ -78,16 +65,12 @@ async function performTests() {
"document.getElem",
"'document.getElem' untab completion"
);
checkInputCompletionValue(
hud,
" entById",
"'document.getElem' completion"
);
checkInputCompletionValue(hud, "entById", "'document.getElem' completion");
ui.clearOutput();
await setInputValueForAutocompletion(hud, "docu");
checkInputCompletionValue(hud, " ment", "'docu' completion");
checkInputCompletionValue(hud, "ment", "'docu' completion");
let onAutocompletUpdated = jsterm.once("autocomplete-updated");
EventUtils.synthesizeKey("KEY_Enter");
@ -101,7 +84,7 @@ async function performTests() {
setInputValue(hud, "console.log('one');\n");
EventUtils.sendString("consol");
await onAutocompletUpdated;
checkInputCompletionValue(hud, "\n e", "multi-line completion");
checkInputCompletionValue(hud, "e", "multi-line completion");
// Test multi-line completion works even if there is text after the cursor
onAutocompletUpdated = jsterm.once("autocomplete-updated");
@ -110,14 +93,14 @@ async function performTests() {
EventUtils.sendString("console.g");
await onAutocompletUpdated;
checkInputValueAndCursorPosition(hud, "{\nconsole.g|\n}");
checkInputCompletionValue(hud, "\n roup", "multi-line completion");
checkInputCompletionValue(hud, "roup", "multi-line completion");
is(autocompletePopup.isOpen, true, "popup is opened");
// Test non-object autocompletion.
await setInputValueForAutocompletion(hud, "Object.name.sl");
checkInputCompletionValue(hud, " ice", "non-object completion");
checkInputCompletionValue(hud, "ice", "non-object completion");
// Test string literal autocompletion.
await setInputValueForAutocompletion(hud, "'Asimov'.sl");
checkInputCompletionValue(hud, " ice", "string literal completion");
}
checkInputCompletionValue(hud, "ice", "string literal completion");
});

Просмотреть файл

@ -22,21 +22,12 @@ const TEST_URI = `data:text/html;charset=utf8,<p>test [ completion.
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
await testInputs(hud);
await testCompletionTextUpdateOnPopupNavigate(hud);
await testAcceptCompletionExistingClosingBracket(hud);
}
});
async function testInputs(hud) {
const tests = [
@ -163,7 +154,7 @@ async function testInput(
);
checkInputCompletionValue(
hud,
" ".repeat(input.length) + expectedCompletionText,
expectedCompletionText,
`${description} - completeNode has expected value`
);
@ -198,25 +189,13 @@ async function testCompletionTextUpdateOnPopupNavigate(hud) {
`"data-test"|"dataTest"|"DATA-TEST"`,
`popup has expected items, in expected order`
);
checkInputCompletionValue(
hud,
" ".repeat(input.length) + `-test"]`,
`completeNode has expected value`
);
checkInputCompletionValue(hud, `-test"]`, `completeNode has expected value`);
EventUtils.synthesizeKey("KEY_ArrowDown");
checkInputCompletionValue(
hud,
" ".repeat(input.length) + `Test"]`,
`completeNode has expected value`
);
checkInputCompletionValue(hud, `Test"]`, `completeNode has expected value`);
EventUtils.synthesizeKey("KEY_ArrowDown");
checkInputCompletionValue(
hud,
" ".repeat(input.length) + `-TEST"]`,
`completeNode has expected value`
);
checkInputCompletionValue(hud, `-TEST"]`, `completeNode has expected value`);
const onPopupClose = autocompletePopup.once("popup-closed");
EventUtils.synthesizeKey("KEY_Tab");

Просмотреть файл

@ -21,15 +21,6 @@ const TEST_URI = `data:text/html;charset=utf8,<p>test [ completion cached result
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
@ -109,7 +100,7 @@ async function performTests() {
);
checkInputCompletionValue(
hud,
" ".repeat(test.initialInput.length) + test.expectedCompletionText,
test.expectedCompletionText,
`completeNode has expected value`
);
for (const {
@ -128,7 +119,7 @@ async function performTests() {
);
checkInputCompletionValue(
hud,
" ".repeat(getInputValue(hud).length) + expectedCompletionText,
expectedCompletionText,
`completeNode has expected value`
);
}
@ -138,7 +129,7 @@ async function performTests() {
EventUtils.synthesizeKey("KEY_Escape");
await onPopupClose;
}
}
});
function getAutocompletePopupLabels(autocompletePopup) {
return autocompletePopup.items.map(i => i.label);

Просмотреть файл

@ -19,15 +19,6 @@ const TEST_URI = `data:text/html;charset=utf8,<p>test case-sensitivity completio
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -45,7 +36,7 @@ async function performTests() {
"fooBar - FooBar",
"popup has expected item, in expected order"
);
checkInputCompletionValue(hud, " ar", "completeNode has expected value");
checkInputCompletionValue(hud, "ar", "completeNode has expected value");
info("Check that filtering the autocomplete cache is also case insensitive");
let onAutoCompleteUpdated = jsterm.once("autocomplete-updated");
@ -59,7 +50,7 @@ async function performTests() {
"fooBar - FooBar",
"popup cache filtering is also case-insensitive"
);
checkInputCompletionValue(hud, " r", "completeNode has expected value");
checkInputCompletionValue(hud, "r", "completeNode has expected value");
info(
"Check that accepting the completion value will change the input casing"
@ -84,11 +75,7 @@ async function performTests() {
"Foo",
"popup has expected item"
);
checkInputCompletionValue(
hud,
" oo",
"completeNode has expected value"
);
checkInputCompletionValue(hud, "oo", "completeNode has expected value");
onPopupClose = autocompletePopup.once("popup-closed");
EventUtils.synthesizeKey("KEY_Tab");
@ -108,7 +95,7 @@ async function performTests() {
"function - Function",
"popup has expected item"
);
checkInputCompletionValue(hud, " tion", "completeNode has expected value");
checkInputCompletionValue(hud, "tion", "completeNode has expected value");
onPopupClose = autocompletePopup.once("popup-closed");
EventUtils.synthesizeKey("KEY_Tab");
@ -136,7 +123,7 @@ async function performTests() {
"Test - TEST",
"popup was filtered case-sensitively, as expected"
);
}
});
function getAutocompletePopupLabels(autocompletePopup) {
return autocompletePopup.items.map(i => i.label);

Просмотреть файл

@ -10,15 +10,6 @@
const TEST_URI = `data:text/html;charset=utf8,<p>test code completion on $_`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -42,7 +33,7 @@ async function performTests() {
);
await setInputValueForAutocompletion(hud, "$_.");
checkInputCompletionValue(hud, " x", "'$_.' completion (completeNode)");
checkInputCompletionValue(hud, "x", "'$_.' completion (completeNode)");
is(
getAutocompletePopupLabels(autocompletePopup).join("|"),
"x|y",
@ -65,7 +56,7 @@ async function performTests() {
true,
"autocomplete popup has expected items"
);
}
});
function getAutocompletePopupLabels(autocompletePopup) {
return autocompletePopup.items.map(i => i.label);

Просмотреть файл

@ -19,15 +19,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
await registerTestActor(toolbox.target.client);
const testActor = await getTestActor(toolbox);
@ -56,7 +47,7 @@ async function performTests() {
true,
"autocomplete popup has expected items"
);
}
});
function getAutocompletePopupLabels(autocompletePopup) {
return autocompletePopup.items.map(i => i.label);

Просмотреть файл

@ -18,15 +18,6 @@ const TEST_URI = `data:text/html;charset=utf8,<p>test completion perfect match.
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -49,7 +40,7 @@ async function performTests() {
"foO - foo - fOo - fOO",
"popup has expected item, in expected order"
);
}
});
function getAutocompletePopupLabels(autocompletePopup) {
return autocompletePopup.items.map(i => i.label);

Просмотреть файл

@ -37,15 +37,6 @@ const TEST_URI = `data:text/html,<meta charset=utf8>
</script>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const { autocompletePopup } = jsterm;
@ -69,7 +60,7 @@ async function performTests() {
);
ok(true, `output is correct for ${helper}()`);
}
}
});
function getPopupLabels(popup) {
return popup.getItems().map(item => item.label);

Просмотреть файл

@ -29,15 +29,6 @@ const TEST_URI = `data:text/html;charset=utf-8,
</body>`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const random = Math.random();
const string = "Text: " + random;
@ -55,7 +46,7 @@ async function performTests() {
}
);
await testCopy(hud, `$("#${id}")`, outerHTML);
}
});
function testCopy(hud, stringToCopy, expectedResult) {
return waitForClipboardPromise(() => {

Просмотреть файл

@ -10,15 +10,6 @@
const TEST_URI = "data:text/html;charset=utf-8,Test console select all";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
// The TabContextMenu initializes its strings only on a focus or mouseover event.
// Calls focus event on the TabContextMenu early in the test.
gBrowser.selectedTab.focus();
@ -45,37 +36,18 @@ async function performTests() {
"control|cmd + e does not move to end of input"
);
}
}
});
function getSelectionTextLength(jsterm) {
if (jsterm.inputNode) {
return jsterm.inputNode.selectionEnd - jsterm.inputNode.selectionStart;
}
if (jsterm.editor) {
return jsterm.editor.getSelection().length;
}
return null;
return jsterm.editor.getSelection().length;
}
function setCursorAtStart(jsterm) {
if (jsterm.inputNode) {
jsterm.inputNode.selectionStart = 0;
}
if (jsterm.editor) {
jsterm.editor.setCursor({ line: 0, ch: 0 });
}
jsterm.editor.setCursor({ line: 0, ch: 0 });
}
function checkSelectionStart(jsterm, expectedCursorIndex, assertionInfo) {
if (jsterm.inputNode) {
const { selectionStart } = jsterm.inputNode;
is(selectionStart, expectedCursorIndex, assertionInfo);
} else {
const [selection] = jsterm.editor.codeMirror.listSelections();
const { head } = selection;
is(head.ch, expectedCursorIndex, assertionInfo);
}
const [selection] = jsterm.editor.codeMirror.listSelections();
const { head } = selection;
is(head.ch, expectedCursorIndex, assertionInfo);
}

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI =
"bug 804845 and bug 619598";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
ok(!getInputValue(hud), "input is empty");
@ -33,7 +24,7 @@ async function performTests() {
testSingleLineInputNavNoHistory(hud);
testMultiLineInputNavNoHistory(hud);
await testNavWithHistory(hud);
}
});
function testSingleLineInputNavNoHistory(hud) {
const checkInput = (expected, assertionInfo) =>

Просмотреть файл

@ -6,15 +6,6 @@
const TEST_URI = "data:text/html,Test evaluating document";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
// check for occurrences of Object XRayWrapper, bug 604430
@ -25,4 +16,4 @@ async function performTests() {
".result"
);
is(node.textContent.includes("xray"), false, "document - no XrayWrapper");
}
});

Просмотреть файл

@ -9,16 +9,6 @@ const TEST_URI = "data:text/html;charset=utf8,<p>Test editor";
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
await pushPref("devtools.webconsole.input.editor", false);
const tab = await addTab(TEST_URI);
@ -55,7 +45,7 @@ async function performTests() {
getInlineOpenEditorButton(hud).click();
await waitFor(() => isEditorModeEnabled(hud));
ok("Editor is open when clicking on the button");
}
});
function getInlineOpenEditorButton(hud) {
return hud.ui.outputNode.querySelector(".webconsole-input-openEditorButton");

Просмотреть файл

@ -13,15 +13,6 @@ const TEST_URI =
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
await pushPref("devtools.webconsole.input.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const testExpressions = [
@ -100,7 +91,7 @@ async function performTests() {
EventUtils.synthesizeKey("KEY_ArrowDown");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(getInputValue(hud), jsExpression, "And the cows are still there...");
}
});
function getEditorToolbar(hud) {
return hud.ui.outputNode.querySelector(".webconsole-editor-toolbar");

Просмотреть файл

@ -13,21 +13,11 @@ const TEST_URI =
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
await pushPref("devtools.webconsole.input.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performEditorEnabledTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performEditorEnabledTests();
});
add_task(async function() {
await pushPref("devtools.webconsole.input.editor", false);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performEditorDisabledTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performEditorDisabledTests();
});

Просмотреть файл

@ -13,19 +13,10 @@ const TEST_URI =
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
await pushPref("devtools.webconsole.input.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const expression = `x = 10`;
setInputValue(hud, expression);
await executeAndWaitForMessage(hud, undefined, "", ".result");
is(getInputValue(hud), expression, "input line is not cleared after submit");
}
});

Просмотреть файл

@ -12,15 +12,6 @@ add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
await pushPref("devtools.webconsole.input.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
// Reset editorWidth pref so we have steady results when running multiple times.
await pushPref("devtools.webconsole.input.editorWidth", null);
@ -60,7 +51,7 @@ async function performTests() {
`${newWidth}px`,
"The width is applied again when switching back to editor"
);
}
});
async function resize(resizer, clientX) {
const doc = resizer.ownerDocument;

Просмотреть файл

@ -12,19 +12,7 @@ const EDITOR_PREF = "devtools.webconsole.input.editor";
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
await pushPref("devtools.webconsole.input.editor", true);
// Run test with legacy JsTerm
info("Test legacy JsTerm");
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTest();
// And then run it with the CodeMirror-powered one.
info("Test codeMirror JsTerm");
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTest();
});
async function performTest() {
// Start with the editor turned off
await pushPref(EDITOR_PREF, false);
let hud = await openNewTabAndConsole(TEST_URI);
@ -56,4 +44,4 @@ async function performTest() {
is(getInputValue(hud), INPUT_VALUE, "The input value wasn't cleared");
Services.prefs.clearUserPref(EDITOR_PREF);
}
});

Просмотреть файл

@ -9,16 +9,6 @@ const TEST_URI = "data:text/html;charset=utf8,<p>Test editor toolbar";
add_task(async function() {
await pushPref("devtools.webconsole.features.editor", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
await pushPref("devtools.webconsole.input.editor", false);
const tab = await addTab(TEST_URI);
@ -123,7 +113,7 @@ async function performTests() {
closeButton.click();
await waitFor(() => !isEditorModeEnabled(hud));
ok(true, "Editor mode is disabled when clicking on the close button");
}
});
function getEditorToolbar(hud) {
return hud.ui.outputNode.querySelector(".webconsole-editor-toolbar");

Просмотреть файл

@ -6,15 +6,6 @@
const TEST_URI = "data:text/html,Test error documentation";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
// Check that errors with entries in errordocs.js display links next to their messages.
@ -55,4 +46,4 @@ async function performTests() {
`The link has the expected "${errorUrl}" href value`
);
}
}
});

Просмотреть файл

@ -9,15 +9,6 @@
const TEST_URI = "data:text/html,Test error documentation";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const text =
@ -33,4 +24,4 @@ async function performTests() {
true,
"Error message displayed as expected, without crashing the console."
);
}
});

Просмотреть файл

@ -9,15 +9,6 @@
const TEST_URI = `data:text/html,<meta charset=utf8>Focus test`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
info("Testing that messages disappear on a refresh if logs aren't persisted");
const hud = await openNewTabAndConsole(TEST_URI);
is(isInputFocused(hud), true, "JsTerm is focused when opening the console");
@ -35,4 +26,4 @@ async function performTests() {
false,
"JsTerm is still unfocused after reloading the page"
);
}
});

Просмотреть файл

@ -6,15 +6,6 @@
const TEST_URI = "data:text/html,Test <code>clear()</code> jsterm helper";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const onMessage = waitForMessage(hud, "message");
@ -29,4 +20,4 @@ async function performTests() {
execute(hud, "clear()");
await onCleared;
ok(true, "Console was cleared");
}
});

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI = `data:text/html,
`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -53,4 +44,4 @@ async function performTests() {
message = await executeAndWaitForMessage(hud, "$('div')", "null", ".result");
ok(message, "`$('div')` does return null");
}
});

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI = `data:text/html,
`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -58,4 +49,4 @@ async function performTests() {
".result"
);
ok(message, "`$$('div')` returns an empty array");
}
});

Просмотреть файл

@ -16,15 +16,6 @@ const TEST_URI = `data:text/html,
`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -115,4 +106,4 @@ async function performTests() {
message,
"$x works as expected with XPathResult.ORDERED_NODE_SNAPSHOT_TYPE"
);
}
});

Просмотреть файл

@ -7,15 +7,6 @@ const TEST_URI = "data:text/html,Test <code>help()</code> jsterm helper";
const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let openedLinks = 0;
@ -45,4 +36,4 @@ async function performTests() {
is(openedLinks, 3, "correct number of pages opened by the help calls");
hud.openLink = oldOpenLink;
}
});

Просмотреть файл

@ -7,15 +7,6 @@ const TEST_URI =
"data:text/html,Test <code>keys()</code> & <code>values()</code> jsterm helper";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -41,4 +32,4 @@ async function performTests() {
".result"
);
ok(message, "`keys(window)` worked");
}
});

Просмотреть файл

@ -6,15 +6,6 @@
const TEST_URI = "data:text/html,Test <code>pprint()</code> jsterm helper";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -51,4 +42,4 @@ async function performTests() {
".result"
);
ok(message, "`pprint(function)` shows function source");
}
});

Просмотреть файл

@ -26,15 +26,6 @@
requestLongerTimeout(2);
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
let browserConsole, webConsole, objInspector;
// We don't use `pushPref()` because we need to revert the same pref later
@ -68,7 +59,7 @@ async function performTests() {
info("Close webconsole and browser console");
await closeConsole(browserTab);
await HUDService.toggleBrowserConsole();
}
});
async function logObject(hud) {
const prop = "browser_console_hide_jsterm_test";

Просмотреть файл

@ -11,14 +11,6 @@ const TEST_URI = "data:text/html;charset=UTF-8,test";
const COMMANDS = ["document", "window", "window.location"];
add_task(async function() {
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await testHistory();
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await testHistory();
});
async function testHistory() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
jsterm.focus();
@ -62,4 +54,4 @@ async function testHistory() {
COMMANDS[idxLast],
"check history next idx:" + idxLast
);
}
});

Просмотреть файл

@ -20,15 +20,6 @@ const TEST_VALUES = [
];
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
@ -158,37 +149,28 @@ async function performTests() {
EventUtils.synthesizeKey("KEY_ArrowDown", option);
checkInput("|", "Cmd+↓: input is empty");
}
}
});
function setCursorAtPosition(hud, pos) {
const { jsterm } = hud;
const { inputNode, editor } = jsterm;
const { editor } = hud.jsterm;
if (editor) {
let line = 0;
let ch = 0;
let currentPos = 0;
getInputValue(hud)
.split("\n")
.every(l => {
if (l.length < pos - currentPos) {
line++;
currentPos += l.length;
return true;
}
ch = pos - currentPos;
return false;
});
return editor.setCursor({ line, ch });
}
return inputNode.setSelectionRange(pos, pos);
let line = 0;
let ch = 0;
let currentPos = 0;
getInputValue(hud)
.split("\n")
.every(l => {
if (l.length < pos - currentPos) {
line++;
currentPos += l.length;
return true;
}
ch = pos - currentPos;
return false;
});
return editor.setCursor({ line, ch });
}
function inputHasNoSelection(jsterm) {
if (jsterm.editor) {
return !jsterm.editor.getDoc().getSelection();
}
return jsterm.inputNode.selectionStart === jsterm.inputNode.selectionEnd;
return !jsterm.editor.getDoc().getSelection();
}

Просмотреть файл

@ -13,16 +13,6 @@ const TEST_URI =
"navigation must not show the autocomplete popup";
add_task(async function() {
// Run in legacy JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await testHistory();
// And then in codeMirror JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await testHistory();
});
async function testHistory() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const popup = jsterm.autocompletePopup;
@ -69,4 +59,4 @@ async function testHistory() {
ok(!popup.isOpen, "popup is not open");
popup.off("popup-opened", onShown);
}
});

Просмотреть файл

@ -19,15 +19,6 @@ const {
} = require("devtools/client/webconsole/selectors/history");
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await testHistory();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await testHistory();
});
async function testHistory() {
info("Setting custom input history pref to " + INPUT_HISTORY_COUNT);
Services.prefs.setIntPref(
"devtools.webconsole.inputHistoryCount",
@ -133,7 +124,7 @@ async function testHistory() {
"Fourth tab has most recent history"
);
await hud4.jsterm.props.clearHistory();
await hud4.ui.wrapper.dispatchClearHistory();
state4 = hud4.ui.wrapper.getStore().getState();
is(
JSON.stringify(getHistoryEntries(state4)),
@ -151,7 +142,7 @@ async function testHistory() {
info("Clearing custom input history pref");
Services.prefs.clearUserPref("devtools.webconsole.inputHistoryCount");
}
});
/**
* Populate the history by running the following commands:

Просмотреть файл

@ -10,15 +10,6 @@
const TEST_URI = "data:text/html;charset=utf8,<p>test inspect() command";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Test `inspect(window)`");
@ -79,7 +70,7 @@ async function performTests() {
1,
"The primitive is displayed as expected"
);
}
});
function findInspectResultMessage(node, index) {
return node.querySelectorAll(".message.result")[index];

Просмотреть файл

@ -7,15 +7,6 @@
const TEST_URI = "data:text/html,Test <code>instanceof</code> evaluation";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
let message = await executeAndWaitForMessage(
@ -41,4 +32,4 @@ async function performTests() {
".result"
);
ok(message, "`instanceof Array` has expected result");
}
});

Просмотреть файл

@ -13,15 +13,6 @@ add_task(async function() {
// Enable pasting with middle-click.
await pushPref("middlemouse.paste", true);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
@ -30,7 +21,7 @@ async function performTests() {
setClipboardText(clipboardContent);
info("Middle-click on the console input");
const node = jsterm.node || jsterm.inputNode;
const node = jsterm.node;
EventUtils.synthesizeMouse(node, 30, 10, { button: 1 }, hud.iframeWindow);
is(
@ -38,7 +29,7 @@ async function performTests() {
clipboardContent,
"clipboard content was pasted in the console input"
);
}
});
function setClipboardText(text) {
const helper = SpecialPowers.Cc[

Просмотреть файл

@ -77,15 +77,6 @@ const DATA = [
];
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
// Let's reset the counts.
Services.telemetry.clearEvents();
@ -121,7 +112,7 @@ async function performTests() {
);
checkEventTelemetry();
}
});
function checkEventTelemetry() {
const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true);

Просмотреть файл

@ -14,15 +14,7 @@ add_task(async function() {
// For now, let's disable editor as we don't know what the final placement of the
// open editor button (which may impact this test).
await pushPref("devtools.webconsole.features.editor", false);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests(true);
});
async function performTests(codeMirror) {
const hud = await openNewTabAndConsole(TEST_URI);
const jsterm = hud.jsterm;
@ -62,17 +54,14 @@ async function performTests(codeMirror) {
);
ok(isInputFocused(hud), "input is still focused");
// We only check the 'unindent' feature for CodeMirror JsTerm.
if (codeMirror) {
info(
"Check that hitting Shift+Tab when input is not empty removed leading tabs"
);
EventUtils.synthesizeKey("KEY_Tab", { shiftKey: true });
checkInputValueAndCursorPosition(
hud,
`|${testString}`,
"The tab char at the the start of the input was removed after hitting Shift+Tab"
);
ok(isInputFocused(hud), "input is still focused");
}
}
info(
"Check that hitting Shift+Tab when input is not empty removed leading tabs"
);
EventUtils.synthesizeKey("KEY_Tab", { shiftKey: true });
checkInputValueAndCursorPosition(
hud,
`|${testString}`,
"The tab char at the the start of the input was removed after hitting Shift+Tab"
);
ok(isInputFocused(hud), "input is still focused");
});

Просмотреть файл

@ -6,15 +6,6 @@
const TEST_URI = "data:text/html,Test evaluating null and undefined";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
// Check that an evaluated null produces "null". See Bug 650780.
@ -28,4 +19,4 @@ async function performTests() {
".result"
);
ok(message, "`undefined` returned the expected value");
}
});

Просмотреть файл

@ -14,15 +14,6 @@ const TEST_URI_NAVIGATE =
"data:text/html;charset=utf-8,<p>testing autocomplete closes";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const popup = hud.jsterm.autocompletePopup;
const popupShown = once(popup, "popup-opened");
@ -35,4 +26,4 @@ async function performTests() {
await addTab(TEST_URI_NAVIGATE);
ok(!popup.isOpen, "Popup closes on tab switch");
}
});

Просмотреть файл

@ -14,15 +14,6 @@ const TEST_URI =
const dpr = "--dpr 1";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
ok(hud, "web console opened");
@ -33,7 +24,7 @@ async function performTests() {
// overflow
await createScrollbarOverflow();
await testFullpageClipboardScrollbar(hud);
}
});
async function testClipboard(hud) {
const command = `:screenshot --clipboard ${dpr}`;

Просмотреть файл

@ -17,22 +17,13 @@ const { FileUtils } = ChromeUtils.import(
const dpr = "--dpr 1";
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
await addTab(TEST_URI);
const hud = await openConsole();
ok(hud, "web console opened");
await testFile(hud);
}
});
async function testFile(hud) {
// Test capture to file

Просмотреть файл

@ -18,15 +18,6 @@ const stringToCopy = "EvilCommand";
add_task(async function() {
await pushPref("devtools.chrome.enabled", false);
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTest();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTest();
});
async function performTest() {
await pushPref("devtools.selfxss.count", 0);
const hud = await openNewTabAndConsole(TEST_URI);
const { ui } = hud;
@ -69,4 +60,4 @@ async function performTest() {
setInputValue(hud, "");
goDoCommand("cmd_paste");
is(getInputValue(hud), stringToCopy, "Paste works");
}
});

Просмотреть файл

@ -6,14 +6,6 @@
const TEST_URI = "data:text/html;charset=utf-8,Test syntax highlighted output";
add_task(async function() {
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
// Syntax highlighting is implemented with a Custom Element:
@ -28,13 +20,7 @@ async function performTests() {
execute(hud, "var a = 'str';");
const message = await onMessage;
const highlighted = message.node.querySelectorAll("syntax-highlighted");
let expectedMarkup;
if (Services.prefs.getBoolPref("devtools.webconsole.jsterm.codeMirror")) {
/* eslint-disable-next-line max-len */
expectedMarkup = `<syntax-highlighted class="cm-s-mozilla"><span class="cm-keyword">var</span> <span class="cm-def">a</span> <span class="cm-operator">=</span> <span class="cm-string">'str'</span>;</syntax-highlighted>`;
} else {
expectedMarkup = `<syntax-highlighted>var a = 'str';</syntax-highlighted>`;
}
const expectedMarkup = `<syntax-highlighted class="cm-s-mozilla"><span class="cm-keyword">var</span> <span class="cm-def">a</span> <span class="cm-operator">=</span> <span class="cm-string">'str'</span>;</syntax-highlighted>`;
is(highlighted.length, 1, "1 syntax highlighted tag");
is(highlighted[0].outerHTML, expectedMarkup, "got expected html");
}
});

Просмотреть файл

@ -13,17 +13,6 @@ const TEST_URI =
const MINIMUM_MESSAGE_HEIGHT = 19;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
// The style is only enabled in the new jsterm.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
const hud = await openNewTabAndConsole(TEST_URI);
const { ui } = hud;
const { document } = ui;
@ -110,7 +99,7 @@ async function performTests() {
appNode.offsetHeight,
"The entire height is taken by filter bar and input"
);
}
});
function testLayout(node) {
is(

Просмотреть файл

@ -42,7 +42,7 @@ add_task(async function() {
});
function waitForBlurredInput(hud) {
const node = hud.jsterm.node || hud.jsterm.inputNode;
const node = hud.jsterm.node;
return new Promise(resolve => {
const lostFocus = () => {
ok(!isInputFocused(hud), "input node is not focused");

Просмотреть файл

@ -16,16 +16,6 @@ const TEST_URI = `data:text/html;charset=utf-8,<p>Test keyboard accessibility</p
`;
add_task(async function() {
// Run in legacy JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then in codeMirror JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
info("Web Console opened");
const outputScroller = hud.ui.outputScroller;
@ -110,4 +100,4 @@ async function performTests() {
outputScroller.ownerDocument.activeElement,
"filter input is focused"
);
}
});

Просмотреть файл

@ -9,15 +9,6 @@
const TEST_URI = `data:text/html,<meta charset=utf8>Test reverse search initial value`;
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
@ -39,12 +30,7 @@ async function performTests() {
setInputValue(hud, "ado");
info(`Select 2 chars ("do") from the input`);
if (jsterm.inputNode) {
jsterm.inputNode.selectionStart = 1;
jsterm.inputNode.selectionEnd = 3;
} else {
jsterm.editor.setSelection({ line: 0, ch: 1 }, { line: 0, ch: 3 });
}
jsterm.editor.setSelection({ line: 0, ch: 1 }, { line: 0, ch: 3 });
info("Check that the reverse search toolbar as the expected initial state");
let reverseSearchElement = await openReverseSearch(hud);
@ -109,4 +95,4 @@ async function performTests() {
"",
"Reverse search input is empty"
);
}
});

Просмотреть файл

@ -15,15 +15,6 @@ const L10N = new LocalizationHelper(
requestLongerTimeout(4);
add_task(async function() {
// Run test with legacy JsTerm
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await performTests();
// And then run it with the CodeMirror-powered one.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await performTests();
});
async function performTests() {
let toolbox;
await addTab(TEST_URI);
await testConsoleLoadOnDifferentPanel();
@ -359,4 +350,4 @@ async function performTests() {
const pref = Services.prefs.getCharPref("devtools.toolbox.host");
is(pref, hostType, "host pref is " + hostType);
}
}
});

Просмотреть файл

@ -9,16 +9,6 @@ const TEST_URI =
"data:text/html;charset=utf-8,<p>Web Console test for splitting</p>";
add_task(async function() {
// Run in legacy JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
await testHistory();
// And then in codeMirror JsTerm.
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
await testHistory();
});
async function testHistory() {
info(
"Test that the split console input is focused and restores the focus properly."
);
@ -47,7 +37,7 @@ async function testHistory() {
);
activeElement = getActiveElement(inspector.panelDoc);
is(activeElement, inspector.searchBox, "Search box is focused");
}
});
function getActiveElement(doc) {
let activeElement = doc.activeElement;

Просмотреть файл

@ -546,15 +546,7 @@ async function setInputValueForAutocompletion(
}
if (Number.isInteger(caretPosition)) {
if (jsterm.inputNode) {
const { inputNode } = jsterm;
inputNode.value = value;
inputNode.setSelectionRange(caretPosition, caretPosition);
}
if (jsterm.editor) {
jsterm.editor.setCursor(jsterm.editor.getPosition(caretPosition));
}
jsterm.editor.setCursor(jsterm.editor.getPosition(caretPosition));
}
}
@ -588,13 +580,7 @@ function checkInputCompletionValue(hud, expectedValue, assertionInfo) {
}
info(`Expects "${expectedValue}", is "${completionValue}"`);
if (hud.jsterm.completeNode) {
is(completionValue, expectedValue, assertionInfo);
} else {
// CodeMirror jsterm doesn't need to add prefix-spaces.
is(completionValue, expectedValue.trim(), assertionInfo);
}
is(completionValue, expectedValue, assertionInfo);
}
/**
@ -606,13 +592,7 @@ function checkInputCompletionValue(hud, expectedValue, assertionInfo) {
*/
function checkInputCursorPosition(hud, expectedCursorIndex, assertionInfo) {
const { jsterm } = hud;
if (jsterm.inputNode) {
const { selectionStart, selectionEnd } = jsterm.inputNode;
is(selectionStart, expectedCursorIndex, assertionInfo);
ok(selectionStart === selectionEnd);
} else {
is(jsterm.editor.getCursor().ch, expectedCursorIndex, assertionInfo);
}
is(jsterm.editor.getCursor().ch, expectedCursorIndex, assertionInfo);
}
/**
@ -643,20 +623,11 @@ function checkInputValueAndCursorPosition(
const inputValue = expectedStringWithCursor.replace("|", "");
const { jsterm } = hud;
is(getInputValue(hud), inputValue, "console input has expected value");
if (jsterm.inputNode) {
is(jsterm.inputNode.selectionStart, jsterm.inputNode.selectionEnd);
is(
jsterm.inputNode.selectionStart,
expectedStringWithCursor.indexOf("|"),
assertionInfo
);
} else {
const lines = expectedStringWithCursor.split("\n");
const lineWithCursor = lines.findIndex(line => line.includes("|"));
const { ch, line } = jsterm.editor.getCursor();
is(line, lineWithCursor, assertionInfo + " - correct line");
is(ch, lines[lineWithCursor].indexOf("|"), assertionInfo + " - correct ch");
}
const lines = expectedStringWithCursor.split("\n");
const lineWithCursor = lines.findIndex(line => line.includes("|"));
const { ch, line } = jsterm.editor.getCursor();
is(line, lineWithCursor, assertionInfo + " - correct line");
is(ch, lines[lineWithCursor].indexOf("|"), assertionInfo + " - correct ch");
}
/**
@ -667,15 +638,7 @@ function checkInputValueAndCursorPosition(
*/
function getInputCompletionValue(hud) {
const { jsterm } = hud;
if (jsterm.completeNode) {
return jsterm.completeNode.value;
}
if (jsterm.editor) {
return jsterm.editor.getAutoCompletionText();
}
return null;
return jsterm.editor.getAutoCompletionText();
}
/**
@ -688,16 +651,7 @@ function isInputFocused(hud) {
const { jsterm } = hud;
const document = hud.ui.outputNode.ownerDocument;
const documentIsFocused = document.hasFocus();
if (jsterm.inputNode) {
return document.activeElement == jsterm.inputNode && documentIsFocused;
}
if (jsterm.editor) {
return documentIsFocused && jsterm.editor.hasFocus();
}
return false;
return documentIsFocused && jsterm.editor.hasFocus();
}
/**

Просмотреть файл

@ -29,23 +29,6 @@ var WebConsoleUtils = {
return str;
},
/**
* Copies certain style attributes from one element to another.
*
* @param Node from
* The target node.
* @param Node to
* The destination node.
*/
copyTextStyles: function(from, to) {
const win = from.ownerDocument.defaultView;
const style = win.getComputedStyle(from);
to.style.fontFamily = style.fontFamily;
to.style.fontSize = style.fontSize;
to.style.fontWeight = style.fontWeight;
to.style.fontStyle = style.fontStyle;
},
/**
* Value of devtools.selfxss.count preference
*

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше