Add custom theming
This commit is contained in:
@@ -22,6 +22,10 @@ func TestCommentMarkdownDistinguishesQuoteAndReply(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCommentMarkdownStylesInlineCode(t *testing.T) {
|
||||
defer applyTheme("dark")
|
||||
if err := applyTheme("dark"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rendered := strings.Join(renderCommentMarkdown(
|
||||
"Use `list_comparison` for this value.", 60,
|
||||
), "\n")
|
||||
@@ -32,11 +36,30 @@ func TestCommentMarkdownStylesInlineCode(t *testing.T) {
|
||||
if strings.Contains(plain, "Use list_comparison for") {
|
||||
t.Fatalf("inline code added surrounding spaces: %q", plain)
|
||||
}
|
||||
if !strings.Contains(rendered, "48;5;236m") {
|
||||
if !strings.Contains(rendered, "48;2;44;48;69m") {
|
||||
t.Fatalf("inline code has no distinct background: %q", rendered)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommentMarkdownUsesActiveThemePalette(t *testing.T) {
|
||||
defer applyTheme("dark")
|
||||
if err := applyTheme("catppuccin-mocha"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rendered := strings.Join(renderCommentMarkdown(
|
||||
"## Heading\n\nUse `value` and [link](https://example.com).\n\n```python\nif ready:\n return 1\n```",
|
||||
80,
|
||||
), "\n")
|
||||
for _, sequence := range []string{
|
||||
"38;2;203;166;247", // Catppuccin mauve heading/link.
|
||||
"38;2;166;227;161", // Catppuccin green inline code/string.
|
||||
} {
|
||||
if !strings.Contains(rendered, sequence) {
|
||||
t.Fatalf("Markdown did not use active palette color %q:\n%q", sequence, rendered)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWrappedQuoteKeepsRailOnEveryLine(t *testing.T) {
|
||||
const width = 28
|
||||
lines := renderCommentMarkdown(
|
||||
|
||||
Reference in New Issue
Block a user