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

nav_sidebar_shared_examples.rb « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e084a9577854cbf379562fb626ecf6f3b58738e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

RSpec.shared_examples 'has nav sidebar' do
  it 'has collapsed nav sidebar on mobile' do
    render

    expect(rendered).to have_selector('.nav-sidebar')
    expect(rendered).not_to have_selector('.sidebar-collapsed-desktop')
    expect(rendered).not_to have_selector('.sidebar-expanded-mobile')
  end
end

RSpec.shared_examples 'page has active tab' do |title|
  it "activates #{title} tab" do
    expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
    expect(find('.sidebar-top-level-items > li.active')).to have_content(title)
  end
end

RSpec.shared_examples 'page has active sub tab' do |title|
  it "activates #{title} sub tab" do
    expect(page).to have_selector('.sidebar-sub-level-items  > li.active:not(.fly-out-top-item)', count: 1)
    expect(find('.sidebar-sub-level-items > li.active:not(.fly-out-top-item)'))
      .to have_content(title)
  end
end