Commit d2d121d5 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '219241-refine-group-creation-form' into 'master'

Refine group creation form

See merge request gitlab-org/gitlab!48490
parents 2d0d5704 d9da46c5
= form_for [:admin, @group] do |f|
= form_errors(@group)
= render 'shared/group_form', f: f
= render 'shared/group_form_description', f: f
= render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group
= render_if_exists 'admin/namespace_plan', f: f
......
......@@ -2,11 +2,6 @@
= render 'shared/group_form', f: f, autofocus: true
.row
.form-group.group-description-holder.col-sm-12
= f.label :avatar, _("Group avatar"), class: 'label-bold'
%div
= render 'shared/choose_avatar_button', f: f
.form-group.col-sm-12
%label.label-bold
= _('Visibility level')
......
......@@ -47,11 +47,3 @@
= f.label :id, class: 'label-bold' do
= _("Group ID")
= f.text_field :id, class: 'form-control', readonly: true
.row
.form-group.group-description-holder.col-sm-8
= f.label :description, class: 'label-bold' do
= _("Group description")
%span (optional)
= f.text_area :description, maxlength: 250,
class: 'form-control js-gfm-input', rows: 4
.row
.form-group.group-description-holder.col-sm-8
= f.label :description, _('Group description (optional)'), class: 'label-bold'
= f.text_area :description, maxlength: 250,
class: 'form-control js-gfm-input', rows: 4
---
title: Refine group creation form
merge_request: 48490
author:
type: changed
......@@ -13241,9 +13241,6 @@ msgstr ""
msgid "Group by"
msgstr ""
msgid "Group description"
msgstr ""
msgid "Group description (optional)"
msgstr ""
......
......@@ -7,7 +7,6 @@ module QA
view 'app/views/shared/_group_form.html.haml' do
element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern
element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern
element :group_description_field, 'text_area :description' # rubocop:disable QA/ElementWithPattern
end
view 'app/views/groups/_new_group_fields.html.haml' do
......@@ -20,10 +19,6 @@ module QA
fill_in 'group_name', with: path
end
def set_description(description)
fill_in 'group_description', with: description
end
def set_visibility(visibility)
choose visibility
end
......
......@@ -36,7 +36,6 @@ module QA
Page::Group::New.perform do |group_new|
group_new.set_path(path)
group_new.set_description(description)
group_new.set_visibility('Public')
group_new.create
end
......
......@@ -31,7 +31,6 @@ module QA
Page::Group::New.perform do |group|
group.set_path(path)
group.set_description('GitLab QA Sandbox Group')
group.set_visibility('Public')
group.create
end
......
......@@ -7,9 +7,10 @@ RSpec.describe 'Admin Groups' do
include Spec::Support::Helpers::Features::MembersHelpers
let(:internal) { Gitlab::VisibilityLevel::INTERNAL }
let(:user) { create :user }
let!(:group) { create :group }
let!(:current_user) { create(:admin) }
let_it_be(:user) { create :user }
let_it_be(:group) { create :group }
let_it_be(:current_user) { create(:admin) }
before do
sign_in(current_user)
......@@ -26,6 +27,17 @@ RSpec.describe 'Admin Groups' do
end
describe 'create a group' do
describe 'with expected fields' do
it 'renders from as expected', :aggregate_failures do
visit new_admin_group_path
expect(page).to have_field('name')
expect(page).to have_field('group_path')
expect(page).to have_field('group_visibility_level_0')
expect(page).to have_field('description')
end
end
it 'creates new group' do
visit admin_groups_path
......
......@@ -17,14 +17,11 @@ RSpec.describe 'Dashboard Group' do
visit dashboard_groups_path
find('.btn-success').click
new_name = 'Samurai'
new_description = 'Tokugawa Shogunate'
fill_in 'group_name', with: new_name
fill_in 'group_description', with: new_description
click_button 'Create group'
expect(current_path).to eq group_path(Group.find_by(name: new_name))
expect(page).to have_content(new_name)
expect(page).to have_content(new_description)
end
end
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Group' do
let(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......@@ -36,6 +36,15 @@ RSpec.describe 'Group' do
end
end
describe 'with expected fields' do
it 'renders from as expected', :aggregate_failures do
expect(page).to have_field('name')
expect(page).to have_field('group_path')
expect(page).to have_field('group_visibility_level_0')
expect(page).not_to have_field('description')
end
end
describe 'with space in group path' do
it 'renders new group form with validation errors' do
fill_in 'Group URL', with: 'space group'
......@@ -135,7 +144,7 @@ RSpec.describe 'Group' do
end
describe 'create a nested group', :js do
let(:group) { create(:group, path: 'foo') }
let_it_be(:group) { create(:group, path: 'foo') }
context 'as admin' do
let(:user) { create(:admin) }
......@@ -185,8 +194,8 @@ RSpec.describe 'Group' do
end
describe 'group edit', :js do
let(:group) { create(:group, :public) }
let(:path) { edit_group_path(group) }
let_it_be(:group) { create(:group, :public) }
let(:path) { edit_group_path(group) }
let(:new_name) { 'new-name' }
before do
......@@ -230,8 +239,8 @@ RSpec.describe 'Group' do
end
describe 'group page with markdown description' do
let(:group) { create(:group) }
let(:path) { group_path(group) }
let_it_be(:group) { create(:group) }
let(:path) { group_path(group) }
before do
group.add_owner(user)
......@@ -271,9 +280,9 @@ RSpec.describe 'Group' do
end
describe 'group page with nested groups', :js do
let!(:group) { create(:group) }
let!(:nested_group) { create(:group, parent: group) }
let!(:project) { create(:project, namespace: group) }
let_it_be(:group) { create(:group) }
let_it_be(:nested_group) { create(:group, parent: group) }
let_it_be(:project) { create(:project, namespace: group) }
before do
group.add_owner(user)
......@@ -304,7 +313,11 @@ RSpec.describe 'Group' do
end
describe 'new subgroup / project button' do
let(:group) { create(:group, project_creation_level: Gitlab::Access::NO_ONE_PROJECT_ACCESS, subgroup_creation_level: Gitlab::Access::OWNER_SUBGROUP_ACCESS) }
let_it_be(:group, reload: true) do
create(:group,
project_creation_level: Gitlab::Access::NO_ONE_PROJECT_ACCESS,
subgroup_creation_level: Gitlab::Access::OWNER_SUBGROUP_ACCESS)
end
before do
group.add_owner(user)
......@@ -341,6 +354,7 @@ RSpec.describe 'Group' do
context 'when user has project and subgroup creation permissions' do
it 'displays "New subgroup" and "New project" buttons' do
group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
visit group_path(group)
page.within '[data-testid="group-buttons"]' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment