From fdff815a4cddd9e956d1bf4cc8f01eeb3384b9ee Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 6 May 2015 17:21:19 -0400 Subject: [PATCH] Add Markdown feature specs for markup inside links It was already working, just want to make sure we don't break it in the future. --- spec/features/markdown_spec.rb | 13 +++++++++++++ spec/fixtures/markdown.md.erb | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb index 3528200e12..3fe593c47b 100644 --- a/spec/features/markdown_spec.rb +++ b/spec/features/markdown_spec.rb @@ -161,6 +161,19 @@ describe 'GitLab Markdown' do end end + describe 'Edge Cases' do + it 'allows markup inside link elements' do + expect(@doc.at_css('a[href="#link-emphasis"]').to_html). + to eq %{text} + + expect(@doc.at_css('a[href="#link-strong"]').to_html). + to eq %{text} + + expect(@doc.at_css('a[href="#link-code"]').to_html). + to eq %{text} + end + end + describe 'EmojiFilter' do it 'parses Emoji' do expect(@doc).to have_selector('img.emoji', count: 10) diff --git a/spec/fixtures/markdown.md.erb b/spec/fixtures/markdown.md.erb index 0c14075855..6b79aad8f8 100644 --- a/spec/fixtures/markdown.md.erb +++ b/spec/fixtures/markdown.md.erb @@ -94,6 +94,14 @@ The problem with SanitizationFilter is that it can be too aggressive. | `1 < 3 & 5` | 1 < 3 & 5 | 1 < 3 & 5 | | `` | <foo> | | +### Edge Cases + +Markdown should be usable inside a link. Let's try! + +- [_text_](#link-emphasis) +- [**text**](#link-strong) +- [`text`](#link-code) + ### EmojiFilter Because life would be :zzz: without Emoji, right? :rocket: