0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-21 17:00:29 +01:00

FIX: upon revisit, start at step 1 if reset on revisit is set

Dieser Commit ist enthalten in:
merefield 2023-06-21 09:53:42 +01:00
Ursprung 0602e59d70
Commit 712c15e845
2 geänderte Dateien mit 16 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -145,7 +145,7 @@ class CustomWizard::Wizard
step.last_step = true
end
if step.previous && step.previous.id === last_completed_step_id
if !@restart_on_revisit && step.previous && step.previous.id === last_completed_step_id
@start = step.id
end
end

Datei anzeigen

@ -226,6 +226,21 @@ describe CustomWizard::Wizard do
end
end
context "with subscription and restart upon revisit" do
before do
enable_subscription("standard")
@wizard.restart_on_revisit = true
CustomWizard::Template.save(@wizard.as_json)
end
it "returns to step 1 if option to clear submissions on each visit is set" do
append_steps
expect(@wizard.unfinished?).to eq(true)
progress_step('step_1')
expect(@wizard.start).to eq('step_1')
end
end
context "with subscription and guest wizard" do
before do
enable_subscription("standard")