Commits vergleichen
2 Commits
main
...
fix_requir
Autor | SHA1 | Datum | |
---|---|---|---|
|
2f7acb9100 | ||
|
c150c83578 |
3 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen
|
@ -28,7 +28,7 @@ class ::CustomWizard::UpdateValidator
|
|||
file_types = field.file_types
|
||||
format = field.format
|
||||
|
||||
if required && !value
|
||||
if required && !value.present?
|
||||
@updater.errors.add(field_id, I18n.t('wizard.field.required', label: label))
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
# name: discourse-custom-wizard
|
||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||
# version: 2.0.7
|
||||
# version: 2.0.8
|
||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||
# contact_emails: development@pavilion.tech
|
||||
|
|
|
@ -114,6 +114,16 @@ describe CustomWizard::UpdateValidator do
|
|||
).to eq(I18n.t('wizard.field.required', label: 'Textarea'))
|
||||
end
|
||||
|
||||
it 'requires required fields with blank string values' do
|
||||
@template[:steps][0][:fields][1][:required] = true
|
||||
CustomWizard::Template.save(@template)
|
||||
|
||||
updater = perform_validation('step_1', step_1_field_2: "")
|
||||
expect(
|
||||
updater.errors.messages[:step_1_field_2].first
|
||||
).to eq(I18n.t('wizard.field.required', label: 'Textarea'))
|
||||
end
|
||||
|
||||
context "subscription fields" do
|
||||
before do
|
||||
enable_subscription("standard")
|
||||
|
|
Laden …
In neuem Issue referenzieren