aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parse/hyperlinks_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parse/hyperlinks_test.go')
-rw-r--r--lib/parse/hyperlinks_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/parse/hyperlinks_test.go b/lib/parse/hyperlinks_test.go
index cedad648..00a06764 100644
--- a/lib/parse/hyperlinks_test.go
+++ b/lib/parse/hyperlinks_test.go
@@ -114,6 +114,26 @@ func TestHyperlinks(t *testing.T) {
text: "You can reach me via the somewhat strange, but nonetheless valid, email mailto:~mpldr/list@[2001:db8::7]?subject=whazzup%3F",
links: []string{"mailto:~mpldr/list@[2001:db8::7]?subject=whazzup%3F"},
},
+ {
+ name: "simple email in <a href>",
+ text: `<a href="mailto:a@abc.com" rel="noopener noreferrer">`,
+ links: []string{"mailto:a@abc.com"},
+ },
+ {
+ name: "simple email in <a> body",
+ text: `<a href="#" rel="noopener noreferrer">a@abc.com</a><br/><p>more text</p>`,
+ links: []string{"mailto:a@abc.com"},
+ },
+ {
+ name: "emails in <a> href and body",
+ text: `<a href="mailto:a@abc.com" rel="noopener noreferrer">b@abc.com</a><br/><p>more text</p>`,
+ links: []string{"mailto:a@abc.com", "mailto:b@abc.com"},
+ },
+ {
+ name: "email in &lt;...&gt;",
+ text: `<div>01.02.2023, 10:11, "Firstname Lastname" &lt;a@abc.com&gt;:</div>`,
+ links: []string{"mailto:a@abc.com"},
+ },
}
for i, test := range tests {