blob: 4b815988bc5effc1dd498d0596ba3c2ffc2c4b61 (
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
27
28
29
30
31
32
33
34
35
36
|
# 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
RSpec.shared_examples 'sidebar includes snowplow attributes' do |track_action, track_label, track_property|
specify do
stub_application_setting(snowplow_enabled: true)
render
expect(rendered).to have_css(".nav-sidebar[data-track-action=\"#{track_action}\"][data-track-label=\"#{track_label}\"][data-track-property=\"#{track_property}\"]")
end
end
|