Skip to content

Commit

Permalink
Merge pull request #57 from jonathanwiesel/hover-alt-tweaks
Browse files Browse the repository at this point in the history
Update alt and title attributes
  • Loading branch information
amclelland authored Feb 8, 2019
2 parents c07df50 + 4dd7e0a commit 9c18b72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/gemojione.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def self.image_url_for_unicode_moji(moji)
def self.image_tag_for_moji(moji)
if use_sprite
emoji = index.find_by_moji(moji)
%Q{<span class="emojione emojione-#{emoji['unicode'].to_s.downcase}" alt="#{ moji }" title="#{ moji }">#{ moji }</span>}
%Q{<span class="emojione emojione-#{emoji['unicode'].to_s.downcase}" alt="#{ emoji['name'] }" title="#{ emoji['shortname'] }">#{ moji }</span>}
else
%Q{<img alt="#{moji}" class="emoji" src="#{ image_url_for_unicode_moji(moji) }"#{ default_size ? ' style="width: '+default_size+';"' : '' }>}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gemojione/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Gemojione
VERSION = "4.0.0"
VERSION = "4.1.0"
end
8 changes: 4 additions & 4 deletions test/gemojione_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

it 'should generate spritesheet tag' do
with_emoji_config(:use_sprite, true) do
assert_equal "<span class=\"emojione emojione-1f300\" alt=\"πŸŒ€\" title=\"πŸŒ€\">πŸŒ€</span>", Gemojione.image_tag_for_moji('πŸŒ€')
assert_equal "<span class=\"emojione emojione-1f300\" alt=\"cyclone\" title=\":cyclone:\">πŸŒ€</span>", Gemojione.image_tag_for_moji('πŸŒ€')
end
end
end
Expand All @@ -99,7 +99,7 @@
with_emoji_config(:use_sprite, true) do
base_string = "I ❀ Emoji"
replaced_string = Gemojione.replace_unicode_moji_with_images(base_string)
assert_equal "I <span class=\"emojione emojione-2764\" alt=\"❀\" title=\"❀\">❀</span> Emoji", replaced_string
assert_equal "I <span class=\"emojione emojione-2764\" alt=\"heart\" title=\":heart:\">❀</span> Emoji", replaced_string
end
end

Expand Down Expand Up @@ -167,7 +167,7 @@
with_emoji_config(:use_sprite, true) do
base_string = "I :heart: Emoji"
replaced_string = Gemojione.replace_named_moji_with_images(base_string)
assert_equal "I <span class=\"emojione emojione-2764\" alt=\"❀\" title=\"❀\">❀</span> Emoji", replaced_string
assert_equal "I <span class=\"emojione emojione-2764\" alt=\"heart\" title=\":heart:\">❀</span> Emoji", replaced_string
end
end

Expand Down Expand Up @@ -266,7 +266,7 @@
it 'should replace ascii moji with span tag for sprite' do
with_emoji_config(:use_sprite, true) do
replaced_string = Gemojione.replace_ascii_moji_with_images("Emoji is :-)")
assert_equal "Emoji is <span class=\"emojione emojione-1f604\" alt=\"πŸ˜„\" title=\"πŸ˜„\">πŸ˜„</span>", replaced_string
assert_equal "Emoji is <span class=\"emojione emojione-1f604\" alt=\"smile\" title=\":smile:\">πŸ˜„</span>", replaced_string
end
end
end
Expand Down

0 comments on commit 9c18b72

Please sign in to comment.