Add missing alt attribute to special avatars

The `alt` attribute is mandatory in image tags. In this case, we're
leaving it empty because we also display text showing whether comments
are made by administrators, moderators or organizations.
This commit is contained in:
Javi Martín
2024-04-08 02:44:02 +02:00
parent 2c9c5d9cd4
commit c29ad265c6
2 changed files with 9 additions and 9 deletions

View File

@@ -10,30 +10,30 @@ describe Comments::AvatarComponent do
expect(page).not_to have_css "img"
end
it "displays the admin avatar for admin comments" do
it "displays the admin avatar with an empty alt attribute for admin comments" do
admin = create(:administrator)
comment = create(:comment, user: admin.user, administrator_id: admin.id)
render_inline Comments::AvatarComponent.new(comment)
expect(page).to have_css "img.admin-avatar"
expect(page).to have_css "img.admin-avatar[alt='']"
end
it "displays the moderator avatar for moderator comments" do
it "displays the moderator avatar with an empty alt attribute for moderator comments" do
moderator = create(:moderator)
comment = create(:comment, user: moderator.user, moderator_id: moderator.id)
render_inline Comments::AvatarComponent.new(comment)
expect(page).to have_css "img.moderator-avatar"
expect(page).to have_css "img.moderator-avatar[alt='']"
end
it "displays the organization avatar for organization comments" do
it "displays the organization avatar with an empty alt attribute for organization comments" do
comment = create(:comment, user: create(:organization).user)
render_inline Comments::AvatarComponent.new(comment)
expect(page).to have_css "img.avatar"
expect(page).to have_css "img.avatar[alt='']"
end
it "displays an empty icon for comments by hidden users" do