diff options
Diffstat (limited to 'spec/components/pajamas')
-rw-r--r-- | spec/components/pajamas/alert_component_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/components/pajamas/alert_component_spec.rb b/spec/components/pajamas/alert_component_spec.rb index e596f07a15a..db425fb2dce 100644 --- a/spec/components/pajamas/alert_component_spec.rb +++ b/spec/components/pajamas/alert_component_spec.rb @@ -138,5 +138,35 @@ RSpec.describe Pajamas::AlertComponent, :aggregate_failures, type: :component do end end end + + context 'with alert_options' do + let(:options) { { alert_options: { id: 'test_id', class: 'baz', data: { foo: 'bar' } } } } + + before do + render_inline described_class.new(**options) + end + + it 'renders the extra options' do + expect(rendered_component).to have_css "#test_id.gl-alert.baz[data-foo='bar']" + end + + context 'with custom classes or data' do + let(:options) do + { + variant: :danger, + alert_class: 'custom', + alert_data: { foo: 'bar' }, + alert_options: { + class: 'extra special', + data: { foo: 'conflict' } + } + } + end + + it 'doesn\'t conflict with internal alert_class or alert_data' do + expect(rendered_component).to have_css ".extra.special.custom.gl-alert.gl-alert-danger[data-foo='bar']" + end + end + end end end |