0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 10:20:28 +01:00
discourse-custom-wizard/assets/javascripts/wizard/tests/acceptance/wizard-test.js.es6

74 Zeilen
2,2 KiB
Text

2022-03-16 12:33:34 +01:00
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { exists } from "../helpers/test";
2022-06-15 08:59:09 +02:00
import acceptance, { count, query, visible } from "../helpers/acceptance";
2022-03-16 12:33:34 +01:00
import {
2022-06-15 08:59:09 +02:00
getWizard,
wizard,
wizardCompleted,
2022-03-16 12:33:34 +01:00
wizardNoUser,
wizardNotPermitted,
} from "../helpers/wizard";
2022-06-15 08:59:09 +02:00
acceptance("Wizard | Not logged in", [getWizard(wizardNoUser)], function () {
test("Wizard no access requires login", async function (assert) {
await visit("/wizard");
assert.ok(exists(".wizard-no-access.requires-login"));
});
});
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
acceptance(
"Wizard | Not permitted",
[getWizard(wizardNotPermitted)],
function () {
2022-03-16 12:33:34 +01:00
test("Wizard no access not permitted", async function (assert) {
await visit("/wizard");
assert.ok(exists(".wizard-no-access.not-permitted"));
});
}
);
2022-06-15 08:59:09 +02:00
acceptance("Wizard | Completed", [getWizard(wizardCompleted)], function () {
test("Wizard no access completed", async function (assert) {
await visit("/wizard");
assert.ok(exists(".wizard-no-access.completed"));
});
});
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
acceptance("Wizard | Wizard", [getWizard(wizard)], function () {
test("Starts", async function (assert) {
await visit("/wizard");
assert.ok(query(".wizard-column"), true);
});
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
test("Applies the body background color", async function (assert) {
await visit("/wizard");
assert.ok($("body")[0].style.background);
});
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
test("Renders the wizard form", async function (assert) {
await visit("/wizard");
assert.ok(visible(".wizard-column-contents .wizard-step"), true);
assert.ok(visible(".wizard-footer img"), true);
});
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
test("Renders the first step", async function (assert) {
await visit("/wizard");
assert.strictEqual(
query(".wizard-step-title p").textContent.trim(),
"Text"
);
assert.strictEqual(
query(".wizard-step-description p").textContent.trim(),
"Text inputs!"
);
assert.strictEqual(
query(".wizard-step-description p").textContent.trim(),
"Text inputs!"
);
assert.strictEqual(count(".wizard-step-form .wizard-field"), 6);
assert.ok(visible(".wizard-step-footer .wizard-progress"), true);
assert.ok(visible(".wizard-step-footer .wizard-buttons"), true);
});
});