diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-16 18:07:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-16 18:07:40 +0300 |
commit | 0e1756ac5c275f8d548c06693b15578baf189d56 (patch) | |
tree | 095610add4bf2e78c66a2dec230438aaf599fdb2 /spec/components | |
parent | 0045970352e8729b2797591beb88a7df884d84f4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/components')
-rw-r--r-- | spec/components/pajamas/alert_component_spec.rb | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/spec/components/pajamas/alert_component_spec.rb b/spec/components/pajamas/alert_component_spec.rb index 8f02979357e..4b554564d6e 100644 --- a/spec/components/pajamas/alert_component_spec.rb +++ b/spec/components/pajamas/alert_component_spec.rb @@ -126,25 +126,45 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do end context 'with dismissible content' do - before do - render_inline described_class.new( - close_button_options: { - class: '_close_button_class_', - data: { - testid: '_close_button_testid_' - } - } - ) - end + context 'with no custom options' do + before do + render_inline described_class.new + end - it 'does not have "not dismissible" class' do - expect(page).not_to have_selector('.gl-alert-not-dismissible') + it 'does not have "not dismissible" class' do + expect(page).not_to have_selector('.gl-alert-not-dismissible') + end + + it 'renders a dismiss button and data' do + expect(page).to have_selector('.gl-button.btn-sm.btn-icon.gl-button.gl-dismiss-btn.js-close') + expect(page).to have_selector("[data-testid='close-icon']") + expect(page).to have_selector('[aria-label="Dismiss"]') + end end - it 'renders a dismiss button and data' do - expect(page).to have_selector('.gl-dismiss-btn.js-close._close_button_class_') - expect(page).to have_selector("[data-testid='close-icon']") - expect(page).to have_selector('[data-testid="_close_button_testid_"]') + context 'with custom options' do + before do + render_inline described_class.new( + close_button_options: { + aria: { + label: '_custom_aria_label_' + }, + class: '_close_button_class_', + data: { + testid: '_close_button_testid_', + "custom-attribute": '_custom_data_' + } + } + ) + end + + it 'renders a dismiss button and data' do + expect(page).to have_selector('.gl-button.btn-sm.btn-icon.gl-dismiss-btn.js-close._close_button_class_') + expect(page).to have_selector("[data-testid='close-icon']") + expect(page).to have_selector('[data-testid="_close_button_testid_"]') + expect(page).to have_selector('[aria-label="Dismiss"]') + expect(page).to have_selector('[data-custom-attribute="_custom_data_"]') + end end end |