| 88 | } |
| 89 | |
| 90 | func TestToTextTrixFigure(t *testing.T) { |
| 91 | got := ToText(`<p>Before</p><figure data-trix-attachment='{"filename":"photo.png","url":"/img.png","contentType":"image/png"}'></figure><p>After</p>`) |
| 92 | if !strings.Contains(got, "[photo.png]") { |
| 93 | t.Errorf("ToText should show filename for trix figure, got %q", got) |
| 94 | } |
| 95 | if !strings.Contains(got, "Before") || !strings.Contains(got, "After") { |
| 96 | t.Errorf("ToText should include surrounding text, got %q", got) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestExtractImageURLs(t *testing.T) { |
| 101 | h := `<p>Hello</p><img src="https://example.com/a.png"><img src="https://example.com/b.jpg">` |