-
-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from MihaZupan/issue_251
Empty image alt text for link reference definitions
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using NUnit.Framework; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Markdig.Tests | ||
{ | ||
[TestFixture] | ||
public class TestImageAltText | ||
{ | ||
[Test] | ||
[TestCase("![](image.jpg)", "")] | ||
[TestCase("![foo](image.jpg)", "foo")] | ||
[TestCase("![][1]\n\n[1]: image.jpg", "")] | ||
[TestCase("![bar][1]\n\n[1]: image.jpg", "bar")] | ||
[TestCase("![](image.jpg 'title')", "")] | ||
[TestCase("![foo](image.jpg 'title')", "foo")] | ||
[TestCase("![][1]\n\n[1]: image.jpg 'title'", "")] | ||
[TestCase("![bar][1]\n\n[1]: image.jpg 'title'", "bar")] | ||
public void TestImageHtmlAltText(string markdown, string expectedAltText) | ||
{ | ||
string html = Markdown.ToHtml(markdown); | ||
string actualAltText = Regex.Match(html, "alt=\"(.*?)\"").Groups[1].Value; | ||
Assert.AreEqual(expectedAltText, actualAltText); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters