Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Tests for the disable-backup-encryption component</title>
<script
src="chrome://browser/content/backup/disable-backup-encryption.mjs"
type="module"
></script>
<link rel="localization" href="preview/backupSettings.ftl"/>
<link rel="localization" href="branding/brand.ftl"/>
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script>
const { BrowserTestUtils } = ChromeUtils.importESModule(
);
/**
* Tests that pressing the confirm button will dispatch the expected events.
*/
add_task(async function test_confirm() {
let disableBackupEncryption = document.getElementById("test-disable-backup-encryption");
let confirmButton = disableBackupEncryption.confirmButtonEl;
ok(confirmButton, "Confirm button should be found");
let content = document.getElementById("content");
let promise = BrowserTestUtils.waitForEvent(content, "BackupUI:DisableEncryption");
confirmButton.click()
await promise;
ok(true, "Detected event after selecting the confirm button");
})
/**
* Tests that pressing the cancel button will dispatch the expected events.
*/
add_task(async function test_cancel() {
let disableBackupEncryption = document.getElementById("test-disable-backup-encryption");
let cancelButton = disableBackupEncryption.cancelButtonEl;
ok(cancelButton, "Cancel button should be found");
let content = document.getElementById("content");
let promise = BrowserTestUtils.waitForEvent(content, "dialogCancel");
cancelButton.click()
await promise;
ok(true, "Detected event after selecting the cancel button");
})
</script>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<disable-backup-encryption id="test-disable-backup-encryption"></disable-backup-encryption>
</div>
<pre id="test"></pre>
</body>
</html>