debian-mirror-gitlab/spec/helpers/emoji_helper_spec.rb

39 lines
977 B
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe EmojiHelper do
2020-04-22 19:07:51 +05:30
describe '#emoji_icon' do
let(:options) { {} }
let(:emoji_text) { 'rocket' }
2021-12-11 22:18:48 +05:30
let(:unicode_version) { '6.0' }
2020-04-22 19:07:51 +05:30
let(:aria_hidden_option) { "aria-hidden=\"true\"" }
subject { helper.emoji_icon(emoji_text, options) }
it 'has no options' do
2023-06-20 00:43:36 +05:30
is_expected.to include(
'<gl-emoji',
"title=\"#{emoji_text}\"",
"data-name=\"#{emoji_text}\"",
"data-unicode-version=\"#{unicode_version}\""
)
2020-04-22 19:07:51 +05:30
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
2023-06-20 00:43:36 +05:30
is_expected.to include(
'<gl-emoji',
"title=\"#{emoji_text}\"",
"data-name=\"#{emoji_text}\"",
"data-unicode-version=\"#{unicode_version}\"",
aria_hidden_option
)
2020-04-22 19:07:51 +05:30
end
end
end
end