diff options
author | Tony Rom <thetonyrom@gmail.com> | 2017-12-20 14:39:40 +0300 |
---|---|---|
committer | Tony Rom <thetonyrom@gmail.com> | 2018-01-29 17:39:19 +0300 |
commit | d90d141c24228b8df6333b03d26a1723480837ba (patch) | |
tree | 008dd759ae827d3d2b0a3320efa4866fec655980 /spec/support | |
parent | 501d81c523b2cf53128e62ea2d7c4dff6681928d (diff) | |
download | gitlab-ce-d90d141c24228b8df6333b03d26a1723480837ba.tar.gz |
Add Colors to GitLab Flavored Markdown
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/matchers/markdown_matchers.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/matchers/markdown_matchers.rb b/spec/support/matchers/markdown_matchers.rb index d12b2757427..ec4ec6f4038 100644 --- a/spec/support/matchers/markdown_matchers.rb +++ b/spec/support/matchers/markdown_matchers.rb @@ -190,6 +190,27 @@ module MarkdownMatchers expect(video['src']).to end_with('/assets/videos/gitlab-demo.mp4') end end + + # ColorFilter + matcher :parse_colors do + set_default_markdown_messages + + match do |actual| + color_chips = actual.css('code > span.gfm-color_chip > span') + + expect(color_chips.count).to eq(9) + + [ + '#F00', '#F00A', '#FF0000', '#FF0000AA', 'RGB(0,255,0)', + 'RGB(0%,100%,0%)', 'RGBA(0,255,0,0.7)', 'HSL(540,70%,50%)', + 'HSLA(540,70%,50%,0.7)' + ].each_with_index do |color, i| + parsed_color = Banzai::ColorParser.parse(color) + expect(color_chips[i]['style']).to match("background-color: #{parsed_color};") + expect(color_chips[i].parent.parent.content).to match(color) + end + end + end end # Monkeypatch the matcher DSL so that we can reduce some noisy duplication for |