Skip to content
代码片段 群组 项目
未验证 提交 5bd35d91 编辑于 作者: Thomas Hutterer's avatar Thomas Hutterer 提交者: GitLab
浏览文件

Add missing breadcrumb items to several admin edit pages

Changelog: fixed
上级 201ef7e0
No related branches found
No related tags found
无相关合并请求
- add_to_breadcrumbs _("Groups"), admin_groups_path
- add_to_breadcrumbs @group.name, admin_group_path(@group)
- breadcrumb_title _("Edit")
- page_title _("Edit"), @group.name, _("Groups")
%h1.page-title.gl-font-size-h-display= _('Edit group: %{group_name}') % { group_name: @group.name }
%hr
= render 'form', visibility_level: @group.visibility_level
- add_to_breadcrumbs _("Projects"), admin_projects_path
- add_to_breadcrumbs @project.full_name, admin_project_path(@project)
- breadcrumb_title _("Edit")
- page_title _("Edit"), @project.name, _("Projects")
%h1.page-title.gl-font-size-h-display= _('Edit project: %{project_name}') % { project_name: @project.name }
%hr
= render 'form'
- add_to_breadcrumbs _("Topics"), admin_topics_path
- add_to_breadcrumbs @topic.name, edit_admin_topic_path(@topic) # There is no show view, so we reuse edit here
- breadcrumb_title _("Edit")
- page_title _("Edit"), @topic.name, _("Topics")
%h1.page-title.gl-font-size-h-display= _('Edit topic: %{topic_name}') % { topic_name: @topic.name }
%hr
= render 'form', url: admin_topic_path(@topic)
- add_to_breadcrumbs _("Users"), admin_users_path
- add_to_breadcrumbs @user.name, admin_user_path(@user)
- breadcrumb_title _("Edit")
- page_title _("Edit"), @user.name, _("Users")
%h1.page-title.gl-font-size-h-display
= _("Edit user: %{user_name}") % { user_name: @user.name }
= render 'form'
......@@ -10,13 +10,6 @@
let!(:deploy_key) { create(:deploy_key, public: true) }
let!(:another_deploy_key) { create(:another_deploy_key, public: true) }
def page_breadcrumbs
all('[data-testid=breadcrumb-links] a').map do |a|
# We use `.dom_attribute` because Selenium transforms `.attribute('href')` to include the full URL.
{ text: a.text, href: a.native.dom_attribute('href') }
end
end
before do
sign_in(admin)
enable_admin_mode!(admin)
......
......@@ -172,6 +172,17 @@
end
describe 'group edit' do
it 'shows all breadcrumbs', :js do
visit admin_group_edit_path(group)
expect(page_breadcrumbs).to eq([
{ text: 'Admin area', href: admin_root_path },
{ text: 'Groups', href: admin_groups_path },
{ text: group.name, href: admin_group_path(group) },
{ text: 'Edit', href: admin_group_edit_path(group) }
])
end
it 'shows the visibility level radio populated with the group visibility_level value' do
group = create(:group, :private)
......
......@@ -176,6 +176,18 @@
end
describe 'project edit' do
it 'shows all breadcrumbs', :js do
project_params = { id: project.to_param, namespace_id: project.namespace.to_param }
visit edit_admin_namespace_project_path(project_params)
expect(page_breadcrumbs).to eq([
{ text: 'Admin area', href: admin_root_path },
{ text: 'Projects', href: admin_projects_path },
{ text: project.full_name, href: admin_namespace_project_path(project_params) },
{ text: 'Edit', href: edit_admin_namespace_project_path(project_params) }
])
end
it 'updates project details' do
project = create(:project, :private, name: 'Garfield', description: 'Funny Cat')
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin Topics', feature_category: :groups_and_projects do
let_it_be(:topic) { create :topic }
let_it_be(:admin) { create(:admin) }
before do
sign_in(admin)
enable_admin_mode!(admin)
end
describe 'topic edit' do
it 'shows all breadcrumbs', :js do
visit edit_admin_topic_path(topic)
expect(page_breadcrumbs).to eq([
{ text: 'Admin area', href: admin_root_path },
{ text: 'Topics', href: admin_topics_path },
{ text: topic.name, href: edit_admin_topic_path(topic) },
{ text: 'Edit', href: edit_admin_topic_path(topic) }
])
end
end
end
......@@ -565,6 +565,15 @@ def check_breadcrumb(content)
visit edit_admin_user_path(user)
end
it 'shows all breadcrumbs', :js do
expect(page_breadcrumbs).to eq([
{ text: 'Admin area', href: admin_root_path },
{ text: 'Users', href: admin_users_path },
{ text: user.name, href: admin_user_path(user) },
{ text: 'Edit', href: edit_admin_user_path(user) }
])
end
describe 'Update user' do
before do
fill_in 'user_name', with: 'Big Bang'
......
......@@ -17,5 +17,12 @@ def all_by_testid(testid, context: page, **kwargs)
def within_testid(testid, context: page, **kwargs, &block)
context.within("[data-testid='#{testid}']", **kwargs, &block)
end
def page_breadcrumbs
all('[data-testid=breadcrumb-links] a').map do |a|
# We use `.dom_attribute` because Selenium transforms `.attribute('href')` to include the full URL.
{ text: a.text, href: a.native.dom_attribute('href') }
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册