Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
FIX: direct step path error when not logged in && fix acceptance tests
Dieser Commit ist enthalten in:
Ursprung
556a32aa5c
Commit
0d7a220f1d
4 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen
|
@ -4,7 +4,12 @@ import Route from "@ember/routing/route";
|
|||
|
||||
export default Route.extend({
|
||||
beforeModel() {
|
||||
this.set("wizard", getCachedWizard());
|
||||
const wizard = getCachedWizard();
|
||||
this.set("wizard", wizard);
|
||||
|
||||
if (!wizard || !wizard.user || !wizard.permitted || wizard.completed) {
|
||||
this.replaceWith("customWizard");
|
||||
}
|
||||
},
|
||||
|
||||
model(params) {
|
||||
|
|
|
@ -21,6 +21,7 @@ acceptance("Step | Not permitted", function (needs) {
|
|||
});
|
||||
|
||||
acceptance("Step | Step", function (needs) {
|
||||
needs.user();
|
||||
needs.pretender((server, helper) => {
|
||||
server.get("/w/wizard.json", () => helper.response(wizard));
|
||||
server.put("/w/wizard/steps/:step_id", () => helper.response(update));
|
||||
|
|
|
@ -18,10 +18,15 @@ acceptance("Wizard | Not logged in", function (needs) {
|
|||
server.get("/w/wizard.json", () => helper.response(wizardNoUser));
|
||||
});
|
||||
|
||||
test("Wizard no access requires login", async function (assert) {
|
||||
test("Requires login", async function (assert) {
|
||||
await visit("/w/wizard");
|
||||
assert.ok(exists(".wizard-no-access.requires-login"));
|
||||
});
|
||||
|
||||
test("Requires login if a step path is used", async function (assert) {
|
||||
await visit("/w/wizard/steps/1");
|
||||
assert.ok(exists(".wizard-no-access.requires-login"));
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Wizard | Not permitted", function (needs) {
|
||||
|
|
|
@ -34,7 +34,7 @@ allFieldsWizard.categories = cloneJSON(categoriesJson["categories"]);
|
|||
allFieldsWizard.groups = cloneJSON(groupsJson["groups"]);
|
||||
|
||||
const update = cloneJSON(updateJson);
|
||||
update.wizard = cloneJSON(wizardJson);
|
||||
update.wizard = cloneJSON(wizard);
|
||||
|
||||
export {
|
||||
wizardNoUser,
|
||||
|
|
Laden …
In neuem Issue referenzieren