2022-06-15 08:59:09 +02:00
|
|
|
import { click, visit } from "@ember/test-helpers";
|
2022-03-16 12:33:34 +01:00
|
|
|
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";
|
|
|
|
import { getWizard, stepNotPermitted, wizard } from "../helpers/wizard";
|
|
|
|
import { saveStep, update } from "../helpers/step";
|
2022-03-16 12:33:34 +01:00
|
|
|
|
2022-06-15 08:59:09 +02:00
|
|
|
acceptance("Step | Not permitted", [getWizard(stepNotPermitted)], function () {
|
|
|
|
test("Shows not permitted message", async function (assert) {
|
|
|
|
await visit("/wizard");
|
|
|
|
assert.ok(exists(".step-message.not-permitted"));
|
|
|
|
});
|
|
|
|
});
|
2022-03-16 12:33:34 +01:00
|
|
|
|
2022-06-15 08:59:09 +02:00
|
|
|
acceptance("Step | Step", [getWizard(wizard), saveStep(update)], function () {
|
|
|
|
test("Renders the 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);
|
|
|
|
});
|
2022-03-16 12:33:34 +01:00
|
|
|
|
2022-06-15 08:59:09 +02:00
|
|
|
test("Goes to the next step", async function (assert) {
|
|
|
|
await visit("/wizard");
|
|
|
|
assert.ok(visible(".wizard-step.step_1"), true);
|
|
|
|
await click(".wizard-btn.next");
|
|
|
|
assert.ok(visible(".wizard-step.step_2"), true);
|
|
|
|
});
|
|
|
|
});
|