fune/browser/components/preferences/in-content/tests/browser_spotlight.js
Paolo Amadini 24c49f1473 Bug 1466817 - The "Edit Pop-up Blocker Options/Preferences" command should open the in-content preferences. r=jaws
Instead of opening the pop-up permissions dialog with the origin already populated, this command now highlights the pop-up permission row in the preferences. This doesn't remove any functionality because the only action that would be available for the origin in the permissions dialog is "Allow", which is equivalent to the "Allow pop-ups for" command in the notification bar menu.

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

--HG--
extra : rebase_source : 064b3d39dc2a8c4d6a3c0949a51ab361ed6e71dd
2018-12-23 20:52:15 +00:00

38 lines
1.6 KiB
JavaScript

add_task(async function test_openPreferences_spotlight() {
for (let [arg, expectedPane, expectedHash, expectedSubcategory] of [
["privacy-reports",
"panePrivacy", "#privacy", "reports"],
["privacy-address-autofill",
"panePrivacy", "#privacy", "address-autofill"],
["privacy-credit-card-autofill",
"panePrivacy", "#privacy", "credit-card-autofill"],
["privacy-form-autofill",
"panePrivacy", "#privacy", "form-autofill"],
["privacy-trackingprotection",
"panePrivacy", "#privacy", "trackingprotection"],
["privacy-permissions-block-popups",
"panePrivacy", "#privacy", "permissions-block-popups"],
]) {
if (arg == "privacy-credit-card-autofill" &&
!Services.prefs.getBoolPref("extensions.formautofill.creditCards.available")) {
continue;
}
let prefs =
await openPreferencesViaOpenPreferencesAPI(arg, { leaveOpen: true });
is(prefs.selectedPane, expectedPane, "The right pane is selected");
let doc = gBrowser.contentDocument;
is(doc.location.hash, expectedHash,
"The subcategory should be removed from the URI");
await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"),
"Wait for the spotlight");
is(doc.querySelector(".spotlight").getAttribute("data-subcategory"),
expectedSubcategory, "The right subcategory is spotlighted");
doc.defaultView.spotlight(null);
is(doc.querySelector(".spotlight"), null,
"The spotlighted section is cleared");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
});