Skip to content

A platform for community discussion. Free, open, simple.

UX: Include custom text field description in signup form (#32624)

Penar Musaraj153ee0eb9f5d
diff --git a/app/assets/javascripts/discourse/app/components/user-fields/text.gjs b/app/assets/javascripts/discourse/app/components/user-fields/text.gjs
index 3346c9631b6..6709c39d342 100644
--- a/app/assets/javascripts/discourse/app/components/user-fields/text.gjs
+++ b/app/assets/javascripts/discourse/app/components/user-fields/text.gjs
@@ -21,13 +21,11 @@ export default class UserFieldText extends UserFieldBase {
{{~#unless this.field.required}}
{{i18n "user_fields.optional"}}{{/unless~}}
</label>
- <InputTip
- @validation={{this.validation}}
- class={{unless this.validation "hidden"}}
- />
- {{#unless this.validation}}
+ {{#if this.validation.failed}}
+ <InputTip @validation={{this.validation}} />
+ {{else}}
<div class="instructions">{{htmlSafe this.field.description}}</div>
- {{/unless}}
+ {{/if}}
</div>
</template>
}
diff --git a/spec/system/signup_spec.rb b/spec/system/signup_spec.rb
index 7f315cd07d2..a72561bab12 100644
--- a/spec/system/signup_spec.rb
+++ b/spec/system/signup_spec.rb
@@ -142,9 +142,13 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|
.fill_email(invite.email)
.fill_username("john")
.fill_password("supersecurepassword")
- .click_create_account
+
+ expect(signup_form).to have_content("What you do for work")
+
+ signup_form.click_create_account
expect(signup_form).to have_content(I18n.t("js.user_fields.required", name: "Occupation"))
expect(signup_form).to have_no_css(".account-created")
+ expect(signup_form).to have_css(".tip.bad", text: "Please enter a value for \"Occupation\"")
end
end
@@ -345,13 +349,13 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|
end
describe "Signup", type: :system do
- context "when fullpage desktop" do
+ context "when desktop" do
include_examples "signup scenarios",
PageObjects::Pages::Signup.new,
PageObjects::Pages::Login.new
end
- context "when fullpage mobile", mobile: true do
+ context "when mobile", mobile: true do
include_examples "signup scenarios",
PageObjects::Pages::Signup.new,
PageObjects::Pages::Login.new