Bug 1517411 - Add test cases for globalThis in js-property-provider test. r=Honza.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-09-13 08:29:13 +00:00
parent 3d0ae40f28
commit 90cc5901b8

View File

@ -132,6 +132,33 @@ function runChecks(dbgObject, environment, sandbox) {
test_has_no_results(results);
}
info("Test that suggestions are given for 'globalThis'");
results = propertyProvider("g");
test_has_result(results, "globalThis");
info("Test that suggestions are given for 'globalThis.'");
results = propertyProvider("globalThis.");
test_has_result(results, "testObject");
info("Test that suggestions are given for '(globalThis).'");
results = propertyProvider("(globalThis).");
test_has_result(results, "testObject");
info(
"Test that suggestions are given for deep 'globalThis' properties access"
);
results = propertyProvider("(globalThis).testObject.propA.");
test_has_result(results, "shift");
results = propertyProvider("(globalThis).testObject.propA[");
test_has_result(results, `"shift"`);
results = propertyProvider("(globalThis)['testObject']['propA'][");
test_has_result(results, `"shift"`);
results = propertyProvider("(globalThis).testObject['propA'].");
test_has_result(results, "shift");
info("Testing lexical scope issues (Bug 1207868)");
results = propertyProvider("foobar");
test_has_result(results, "foobar");