Merge pull request #249 from paviliondev/fix_reset_behaviour
FIX: upon revisit, start at step 1 if reset on revisit is set
Dieser Commit ist enthalten in:
Commit
7561bc8042
3 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen
|
@ -145,7 +145,7 @@ class CustomWizard::Wizard
|
||||||
step.last_step = true
|
step.last_step = true
|
||||||
end
|
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
|
@start = step.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||||
# version: 2.4.5
|
# version: 2.4.6
|
||||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact_emails: development@pavilion.tech
|
# contact_emails: development@pavilion.tech
|
||||||
|
|
|
@ -226,6 +226,21 @@ describe CustomWizard::Wizard do
|
||||||
end
|
end
|
||||||
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
|
context "with subscription and guest wizard" do
|
||||||
before do
|
before do
|
||||||
enable_subscription("standard")
|
enable_subscription("standard")
|
||||||
|
|
Laden …
In neuem Issue referenzieren