Skip to content

Commit e366990

Browse files
committed
Add tests to check that email addresses with underscores are linked
1 parent 9689831 commit e366990

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/AutolinkerSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,12 @@ describe( "Autolinker", function() {
835835
} );
836836

837837

838+
it( "should properly link an email address with underscopres", function() {
839+
var result = autolinker.link( "Joe's email is ([email protected])" );
840+
expect( result ).toBe( 'Joe\'s email is (<a href="mailto:[email protected]">[email protected]</a>)' );
841+
} );
842+
843+
838844
it( "should automatically link an email address with accented characters", function() {
839845
var result = autolinker.link( "Joe's email is mañana@mañana.com" );
840846
expect( result ).toBe( 'Joe\'s email is <a href="mailto:mañana@mañana.com">mañana@mañana.com</a>' );

tests/matcher/EmailSpec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ describe( "Autolinker.matcher.Email", function() {
6060
MatchChecker.expectEmailMatch( matches[ 0 ], '[email protected]', 7 );
6161
} );
6262

63+
64+
it( 'a match with underscores should be parsed correctly', function() {
65+
var matches = matcher.parseMatches( 'Hello [email protected]' );
66+
67+
expect( matches.length ).toBe( 1 );
68+
MatchChecker.expectEmailMatch( matches[ 0 ], '[email protected]', 6 );
69+
} );
70+
6371
} );
6472

6573

0 commit comments

Comments
 (0)