markup/goldmark: Add a test case
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 4 Sep 2020 08:23:02 +0000 (10:23 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 4 Sep 2020 08:23:02 +0000 (10:23 +0200)
Updates #7619

markup/goldmark/convert_test.go

index 4264f2268e04eb3e9c105609fba6d9fa90d9ac74..9500d2aacb94afe331b54924018e4284b3017621 100644 (file)
@@ -195,6 +195,26 @@ func TestConvertAutoIDBlackfriday(t *testing.T) {
        c.Assert(got, qt.Contains, "<h2 id=\"let-s-try-this-shall-we\">")
 }
 
+func TestConvertIssues(t *testing.T) {
+       c := qt.New(t)
+
+       // https://github.com/gohugoio/hugo/issues/7619
+       c.Run("Hyphen in HTML attributes", func(c *qt.C) {
+               mconf := markup_config.Default
+               mconf.Goldmark.Renderer.Unsafe = true
+               input := `<custom-element>
+    <div>This will be "slotted" into the custom element.</div>
+</custom-element>
+`
+
+               b := convert(c, mconf, input)
+               got := string(b.Bytes())
+
+               c.Assert(got, qt.Contains, "<p><custom-element>\n<div>This will be &ldquo;slotted&rdquo; into the custom element.</div>\n</custom-element></p>\n")
+       })
+
+}
+
 func TestCodeFence(t *testing.T) {
        c := qt.New(t)