Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8e151ad7
Commit
8e151ad7
authored
Mar 23, 2020
by
Gilang Gumilar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create insert_before_sub_nav_item helper
parent
36047277
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
ee/spec/features/groups/navbar_spec.rb
ee/spec/features/groups/navbar_spec.rb
+1
-1
spec/support/helpers/navbar_structure_helper.rb
spec/support/helpers/navbar_structure_helper.rb
+11
-0
No files found.
ee/spec/features/groups/navbar_spec.rb
View file @
8e151ad7
...
@@ -35,7 +35,7 @@ describe 'Group navbar' do
...
@@ -35,7 +35,7 @@ describe 'Group navbar' do
before
do
before
do
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
stub_licensed_features
(
cycle_analytics_for_groups:
true
)
insert_
after
_sub_nav_item
(
insert_
before
_sub_nav_item
(
_
(
'Contribution'
),
_
(
'Contribution'
),
within:
_
(
'Analytics'
),
within:
_
(
'Analytics'
),
new_sub_nav_item_name:
_
(
'Value Stream'
)
new_sub_nav_item_name:
_
(
'Value Stream'
)
...
...
spec/support/helpers/navbar_structure_helper.rb
View file @
8e151ad7
...
@@ -18,4 +18,15 @@ module NavbarStructureHelper
...
@@ -18,4 +18,15 @@ module NavbarStructureHelper
index
=
hash
[
:nav_sub_items
].
find_index
(
before_sub_nav_item_name
)
index
=
hash
[
:nav_sub_items
].
find_index
(
before_sub_nav_item_name
)
hash
[
:nav_sub_items
].
insert
(
index
+
1
,
new_sub_nav_item_name
)
hash
[
:nav_sub_items
].
insert
(
index
+
1
,
new_sub_nav_item_name
)
end
end
def
insert_before_sub_nav_item
(
after_sub_nav_item_name
,
within
:,
new_sub_nav_item_name
:)
expect
(
structure
).
to
include
(
a_hash_including
(
nav_item:
within
))
hash
=
structure
.
find
{
|
h
|
h
[
:nav_item
]
==
within
}
expect
(
hash
).
to
have_key
(
:nav_sub_items
)
expect
(
hash
[
:nav_sub_items
]).
to
include
(
after_sub_nav_item_name
)
index
=
hash
[
:nav_sub_items
].
find_index
(
after_sub_nav_item_name
)
hash
[
:nav_sub_items
].
insert
(
index
,
new_sub_nav_item_name
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment