diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 18:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 18:08:59 +0300 |
commit | 23288f62da73fb0e30d8e7ce306665e8fda1b932 (patch) | |
tree | 2baf1339e4d7c7c35d6b8a52cfb90597a5d4cdf1 /spec/support/shared_examples/features | |
parent | 7cc6872401eb487ed20dbb9d455f8bb9c97d9e39 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/features')
-rw-r--r-- | spec/support/shared_examples/features/navbar_shared_examples.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/navbar_shared_examples.rb b/spec/support/shared_examples/features/navbar_shared_examples.rb new file mode 100644 index 00000000000..a963739878e --- /dev/null +++ b/spec/support/shared_examples/features/navbar_shared_examples.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'verified navigation bar' do + it 'renders correctly' do + current_structure = page.find_all('.sidebar-top-level-items > li', class: ['!hidden']).map do |item| + nav_item = item.find_all('a').first.text.gsub(/\s+\d+$/, '') # remove counts at the end + + nav_sub_items = item + .find_all('.sidebar-sub-level-items a') + .map(&:text) + .drop(1) # remove the first hidden item + + { nav_item: nav_item, nav_sub_items: nav_sub_items } + end + + structure.each { |s| s[:nav_sub_items].compact! } + + expect(current_structure).to eq(structure) + end +end |