package grammaratur
import (
"strings"
"testing"
)
func TestAuthoringNestedLists(t *testing.T) {
for _, source := range []string{
"
",
"",
"",
"- Parent
",
"",
} {
md, err := HTMLToMarkdownAuthoring(source)
if htmlStructure(source) != htmlStructure(MarkdownAuthoringHTML(md)) {
t.Errorf("list structure changed: %q", md)
}
if err != nil || strings.Contains(md, "{=html}") {
plain, _ := HTMLToMarkdown(source)
t.Errorf("source=%q md=%q plain=%q rendered=%q err=%v", source, md, plain, MarkdownToHTML(plain), err)
}
}
}
func TestAuthoringNestedListPreservesAttributes(t *testing.T) {
source := ``
md, err := HTMLToMarkdownAuthoring(source)
if err != nil || MarkdownAuthoringHTML(md) != source {
t.Fatalf("protected list changed: %q %v", md, err)
}
}