mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
FEATURE: Implement new required options in admin user fields UI (#27079)
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
This commit is contained in:
28
spec/system/admin_user_fields_spec.rb
Normal file
28
spec/system/admin_user_fields_spec.rb
Normal file
@ -0,0 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "Admin User Fields", type: :system, js: true do
|
||||
fab!(:current_user) { Fabricate(:admin) }
|
||||
|
||||
before { sign_in(current_user) }
|
||||
|
||||
let(:user_fields_page) { PageObjects::Pages::AdminUserFields.new }
|
||||
|
||||
it "correctly saves user fields" do
|
||||
user_fields_page.visit
|
||||
user_fields_page.add_field(name: "Occupation", description: "What you do for work")
|
||||
|
||||
expect(user_fields_page).to have_user_field("Occupation")
|
||||
|
||||
user_fields_page.refresh
|
||||
|
||||
expect(user_fields_page).to have_user_field("Occupation")
|
||||
end
|
||||
|
||||
it "displays an error when missing required fields" do
|
||||
user_fields_page.visit
|
||||
|
||||
user_fields_page.add_field(name: "Occupation", description: "")
|
||||
|
||||
expect(user_fields_page).to have_text(/Description can't be blank/)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user