forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1604411 - Add expression variables in autocomplete popup. r=Honza.
Variables are retrieved from CodeMirror state and sent to the webconsole actor, where the filtering is done. Differential Revision: https://phabricator.services.mozilla.com/D57427
- Loading branch information
Showing
9 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
devtools/client/webconsole/test/browser/browser_jsterm_autocomplete_expression_variables.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
// Tests that variable created in the expression are displayed in the autocomplete. | ||
|
||
"use strict"; | ||
|
||
const TEST_URI = `data:text/html;charset=utf8,Test autocompletion for expression variables<script> | ||
var testGlobal; | ||
</script>`; | ||
|
||
add_task(async function() { | ||
const hud = await openNewTabAndConsole(TEST_URI); | ||
const { jsterm } = hud; | ||
const { autocompletePopup } = jsterm; | ||
|
||
await setInputValueForAutocompletion( | ||
hud, | ||
` | ||
var testVar; | ||
let testLet; | ||
const testConst; | ||
class testClass {} | ||
function testFunc(testParam1, testParam2, ...testParamRest) { | ||
var [testParamRestFirst] = testParamRest; | ||
let {testDeconstruct1,testDeconstruct2, ...testDeconstructRest} = testParam1; | ||
test` | ||
); | ||
|
||
is( | ||
getPopupLabels(autocompletePopup).join("\n"), | ||
[ | ||
"testClass", | ||
"testConst", | ||
"testDeconstruct1", | ||
"testDeconstruct2", | ||
"testDeconstructRest", | ||
"testFunc", | ||
"testGlobal", | ||
"testLet", | ||
"testParam1", | ||
"testParam2", | ||
"testParamRest", | ||
"testParamRestFirst", | ||
"testVar", | ||
].join("\n"), | ||
"Autocomplete popup displays both global and local variables" | ||
); | ||
}); | ||
|
||
function getPopupLabels(popup) { | ||
return popup.getItems().map(item => item.label); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters