diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-03-03 11:56:02 -0600 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-03-06 12:54:46 -0600 |
commit | f602efea65c2a816c7e29be546d2eb412fe538cc (patch) | |
tree | 3b58078142d489dd2cd69a782830e92f687b3ca3 /spec | |
parent | 2d6492561c8b34595abc3638f8991d7aa6af7151 (diff) | |
download | gitlab-ce-f602efea65c2a816c7e29be546d2eb412fe538cc.tar.gz |
Fix wrong image src with cached gl-emoji and relative root
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/banzai/filter/emoji_filter_spec.rb | 19 | ||||
-rw-r--r-- | spec/support/matchers/markdown_matchers.rb | 3 |
3 files changed, 3 insertions, 21 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index c201d37971a..9ffd4b9371c 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -113,7 +113,7 @@ describe GitlabMarkdownHelper do it 'replaces commit message with emoji to link' do actual = link_to_gfm(':book:Book', '/foo') expect(actual). - to eq '<gl-emoji data-name="book" data-fallback-src="/assets/emoji/book.png" data-unicode-version="6.0">📖</gl-emoji><a href="/foo">Book</a>' + to eq '<gl-emoji data-name="book" data-unicode-version="6.0">📖</gl-emoji><a href="/foo">Book</a>' end end diff --git a/spec/lib/banzai/filter/emoji_filter_spec.rb b/spec/lib/banzai/filter/emoji_filter_spec.rb index f365949f5bf..707212e07fd 100644 --- a/spec/lib/banzai/filter/emoji_filter_spec.rb +++ b/spec/lib/banzai/filter/emoji_filter_spec.rb @@ -88,11 +88,6 @@ describe Banzai::Filter::EmojiFilter, lib: true do expect(doc.css('gl-emoji').first.attr('data-name')).to eq 'thumbsdown' end - it 'has a data-fallback-src attribute' do - doc = filter(':-1:') - expect(doc.css('gl-emoji').first.attr('data-fallback-src')).to end_with '.png' - end - it 'has a data-unicode-version attribute' do doc = filter(':-1:') expect(doc.css('gl-emoji').first.attr('data-unicode-version')).to eq '6.0' @@ -109,18 +104,4 @@ describe Banzai::Filter::EmojiFilter, lib: true do expect(doc.to_html).to match(/^This deserves a <gl-emoji.+>, big time\.\z/) end - - it 'uses a custom asset_host context' do - ActionController::Base.asset_host = 'https://cdn.example.com' - - doc = filter(':frowning:', asset_host: 'https://this-is-ignored-i-guess?') - expect(doc.css('gl-emoji').first.attr('data-fallback-src')).to start_with('https://cdn.example.com') - end - - it 'uses a custom asset_host context' do - ActionController::Base.asset_host = 'https://cdn.example.com' - - doc = filter("'🎱'", asset_host: 'https://this-is-ignored-i-guess?') - expect(doc.css('gl-emoji').first.attr('data-fallback-src')).to start_with('https://cdn.example.com') - end end diff --git a/spec/support/matchers/markdown_matchers.rb b/spec/support/matchers/markdown_matchers.rb index 13fc619d647..bbbbaf4c5e8 100644 --- a/spec/support/matchers/markdown_matchers.rb +++ b/spec/support/matchers/markdown_matchers.rb @@ -29,7 +29,8 @@ module MarkdownMatchers expect(actual).to have_selector('gl-emoji', count: 10) emoji_element = actual.at_css('gl-emoji') - expect(emoji_element['data-fallback-src'].to_s).to start_with('/assets') + expect(emoji_element['data-name'].to_s).not_to be_empty + expect(emoji_element['data-unicode-version'].to_s).not_to be_empty end end |