diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a6ab4044bcb..20da199d437 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -117,7 +117,8 @@ module ApplicationHelper inline_svg_tag( "400-24px/#{icon}.svg", class: ['icon', "material-#{icon}"].concat(attributes[:class].to_s.split), - role: :img + role: :img, + data: attributes[:data] ) end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 463a90b6986..95e6976169e 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -59,6 +59,15 @@ describe ApplicationHelper do end end + describe '#material_symbol' do + it 'returns an svg with the icon and options' do + expect(helper.material_symbol('lock', class: :test, data: { hidden: true })) + .to match('') + .and match('class="icon material-lock test"') + .and match('data-hidden="true"') + end + end + describe 'open_registrations?' do it 'returns true when open for registrations' do allow(Setting).to receive(:[]).with('registrations_mode').and_return('open')