2020-03-30 23:07:51 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe EmojiHelper do
|
2020-03-30 23:07:51 -04:00
|
|
|
describe '#emoji_icon' do
|
|
|
|
let(:options) { {} }
|
|
|
|
let(:emoji_text) { 'rocket' }
|
2021-10-19 17:12:08 -04:00
|
|
|
let(:unicode_version) { '6.0' }
|
2020-03-30 23:07:51 -04:00
|
|
|
let(:aria_hidden_option) { "aria-hidden=\"true\"" }
|
|
|
|
|
|
|
|
subject { helper.emoji_icon(emoji_text, options) }
|
|
|
|
|
|
|
|
it 'has no options' do
|
|
|
|
is_expected.to include('<gl-emoji',
|
|
|
|
"title=\"#{emoji_text}\"",
|
|
|
|
"data-name=\"#{emoji_text}\"",
|
2021-10-19 17:12:08 -04:00
|
|
|
"data-unicode-version=\"#{unicode_version}\"")
|
2020-03-30 23:07:51 -04:00
|
|
|
is_expected.not_to include(aria_hidden_option)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with aria-hidden option' do
|
|
|
|
let(:options) { { 'aria-hidden': true } }
|
|
|
|
|
|
|
|
it 'applies aria-hidden' do
|
|
|
|
is_expected.to include('<gl-emoji',
|
|
|
|
"title=\"#{emoji_text}\"",
|
|
|
|
"data-name=\"#{emoji_text}\"",
|
2021-10-19 17:12:08 -04:00
|
|
|
"data-unicode-version=\"#{unicode_version}\"",
|
2020-03-30 23:07:51 -04:00
|
|
|
aria_hidden_option)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|