| 75 | } |
| 76 | |
| 77 | func TestToTextActionTextAttachment(t *testing.T) { |
| 78 | got := ToText(`<p>Text</p><action-text-attachment filename="photo.png"><img src="url"></action-text-attachment><p>More</p>`) |
| 79 | if !strings.Contains(got, "[photo.png]") { |
| 80 | t.Errorf("ToText should show filename for action-text-attachment, got %q", got) |
| 81 | } |
| 82 | if !strings.Contains(got, "Text") || !strings.Contains(got, "More") { |
| 83 | t.Errorf("ToText should include surrounding text, got %q", got) |
| 84 | } |
| 85 | if strings.Contains(got, "[image]") { |
| 86 | t.Errorf("ToText should skip inner content of action-text-attachment, got %q", got) |
| 87 | } |
| 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>`) |