Commit 188f9e45 authored by Corinna Wiesner's avatar Corinna Wiesner

Remove dismissal ability for manual banners

The banners for manual renewal and manual quarterly co-term are not
supposed to be dismissable anymore. Therefore, the logic to dismiss the
banners is removed.
parent 7336ec90
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
= render 'shared/global_alert', = render 'shared/global_alert',
title: payload.subject, title: payload.subject,
variant: payload.display_error_version? ? :danger : :warning, variant: payload.display_error_version? ? :danger : :warning,
close_button_class: 'js-close',
alert_class: 'gl-my-5', alert_class: 'gl-my-5',
alert_data: { testid: 'close-manual-quarterly-co-term-banner' } do alert_data: { testid: 'manual-quarterly-co-term-banner' },
dismissible: false do
.gl-alert-body .gl-alert-body
= payload.body = payload.body
.gl-alert-actions .gl-alert-actions
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
= render 'shared/global_alert', = render 'shared/global_alert',
title: payload.subject, title: payload.subject,
variant: payload.display_error_version? ? :danger : :warning, variant: payload.display_error_version? ? :danger : :warning,
close_button_class: 'js-close', alert_class: 'gl-my-5',
alert_class: 'gl-mt-5 gl-mb-5', alert_data: { testid: 'manual-renewal-banner' },
alert_data: { testid: 'close-manual-renewal-banner' } do dismissible: false do
.gl-alert-body .gl-alert-body
= payload.body = payload.body
.gl-alert-actions .gl-alert-actions
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:| RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:|
shared_examples 'a visible dismissible manual quarterly co-term banner' do shared_examples 'a visible manual quarterly co-term banner' do
context 'when dismissed' do it 'displays a banner' do
before do expect(page).to have_selector('[data-testid="manual-quarterly-co-term-banner"]')
page.within(find('[data-testid="close-manual-quarterly-co-term-banner"]', match: :first)) do
click_button 'Dismiss'
end
end
it_behaves_like 'a hidden manual quarterly co-term banner'
context 'when visiting again' do
before do
visit current_path
end
it 'displays a banner' do
expect(page).to have_selector('[data-testid="close-manual-quarterly-co-term-banner"]')
end
end
end end
end end
shared_examples 'a hidden manual quarterly co-term banner' do shared_examples 'a hidden manual quarterly co-term banner' do
it 'does not display a banner' do it 'does not display a banner' do
expect(page).not_to have_selector('[data-testid="close-manual-quarterly-co-term-banner"]') expect(page).not_to have_selector('[data-testid="manual-quarterly-co-term-banner"]')
end end
end end
...@@ -56,7 +40,7 @@ RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:| ...@@ -56,7 +40,7 @@ RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:|
context 'within notification window' do context 'within notification window' do
let(:reconciliation_date) { Date.current + reminder_days } let(:reconciliation_date) { Date.current + reminder_days }
it_behaves_like 'a visible dismissible manual quarterly co-term banner' it_behaves_like 'a visible manual quarterly co-term banner'
end end
context 'outside of notification window' do context 'outside of notification window' do
...@@ -69,7 +53,7 @@ RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:| ...@@ -69,7 +53,7 @@ RSpec.shared_examples 'manual quarterly co-term banner' do |path_to_visit:|
context 'when reconciliation date was passed' do context 'when reconciliation date was passed' do
let(:reconciliation_date) { Date.current } let(:reconciliation_date) { Date.current }
it_behaves_like 'a visible dismissible manual quarterly co-term banner' it_behaves_like 'a visible manual quarterly co-term banner'
end end
context 'when reconciliation date is outside of the notification window' do context 'when reconciliation date is outside of the notification window' do
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'manual renewal banner' do |path_to_visit:| RSpec.shared_examples 'manual renewal banner' do |path_to_visit:|
shared_examples 'a visible dismissible manual renewal banner' do shared_examples 'a visible manual renewal banner' do
context 'when dismissed' do it 'displays a banner' do
before do expect(page).to have_selector('[data-testid="manual-renewal-banner"]')
page.within(find('[data-testid="close-manual-renewal-banner"]', match: :first)) do
click_button 'Dismiss'
end
end
it_behaves_like 'a hidden manual renewal banner'
context 'when visiting again' do
before do
visit current_path
end
it 'displays a banner' do
expect(page).to have_selector('[data-testid="close-manual-renewal-banner"]')
end
end
end end
end end
shared_examples 'a hidden manual renewal banner' do shared_examples 'a hidden manual renewal banner' do
it 'does not display a banner' do it 'does not display a banner' do
expect(page).not_to have_selector('[data-testid="close-manual-renewal-banner"]') expect(page).not_to have_selector('[data-testid="manual-renewal-banner"]')
end end
end end
...@@ -54,7 +38,7 @@ RSpec.shared_examples 'manual renewal banner' do |path_to_visit:| ...@@ -54,7 +38,7 @@ RSpec.shared_examples 'manual renewal banner' do |path_to_visit:|
context 'within notification window' do context 'within notification window' do
let(:expires_at) { Date.today + reminder_days } let(:expires_at) { Date.today + reminder_days }
it_behaves_like 'a visible dismissible manual renewal banner' it_behaves_like 'a visible manual renewal banner'
end end
context 'outside of notification window' do context 'outside of notification window' do
...@@ -67,7 +51,7 @@ RSpec.shared_examples 'manual renewal banner' do |path_to_visit:| ...@@ -67,7 +51,7 @@ RSpec.shared_examples 'manual renewal banner' do |path_to_visit:|
context 'when subscription is expired' do context 'when subscription is expired' do
let(:expires_at) { Date.today } let(:expires_at) { Date.today }
it_behaves_like 'a visible dismissible manual renewal banner' it_behaves_like 'a visible manual renewal banner'
end end
context 'when subscription is not expiring/expired yet' do context 'when subscription is not expiring/expired yet' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment