mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Handle data attributes in material symbol helper
This commit is contained in:
parent
658addcbf7
commit
05d2e3b8b0
2 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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('<svg.*/svg>')
|
||||
.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')
|
||||
|
|
Loading…
Reference in a new issue