Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 18:09:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 18:09:41 +0300
commit78d8830cec030ff12afed3c8ae1dddec454d0a24 (patch)
treeb5494f60c7d28be787eee7872fd3d99dcbf9f8c8 /spec/support/helpers
parent652bd073731b0028641672a75355c7918b5ac116 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/navbar_structure_helper.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/helpers/navbar_structure_helper.rb b/spec/support/helpers/navbar_structure_helper.rb
new file mode 100644
index 00000000000..cfb1b185560
--- /dev/null
+++ b/spec/support/helpers/navbar_structure_helper.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module NavbarStructureHelper
+ def insert_after_nav_item(before_nav_item_name, new_nav_item:)
+ expect(structure).to include(a_hash_including(nav_item: before_nav_item_name))
+
+ index = structure.find_index { |h| h[:nav_item] == before_nav_item_name }
+ structure.insert(index + 1, new_nav_item)
+ end
+
+ def insert_after_sub_nav_item(before_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(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)
+ end
+end