Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Tests for the turn-off-scheduled-backups component</title>
<script
src="chrome://browser/content/backup/turn-off-scheduled-backups.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 turnOffScheduledBackups = document.getElementById("test-turn-off-scheduled-backups");
let confirmButton = turnOffScheduledBackups.confirmButtonEl;
ok(confirmButton, "Confirm button should be found");
let content = document.getElementById("content");
let promise = BrowserTestUtils.waitForEvent(content, "BackupUI:DisableScheduledBackups");
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 turnOffScheduledBackups = document.getElementById("test-turn-off-scheduled-backups");
let cancelButton = turnOffScheduledBackups.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">
<turn-off-scheduled-backups id="test-turn-off-scheduled-backups"></turn-off-scheduled-backups>
</div>
<pre id="test"></pre>
</body>
</html>