Skip to content

Commit 5bffb09

Browse files
committed
Merge branch 'handle_twitter_parens' of git://github.com/busticated/Autolinker.js into busticated-handle_twitter_parens
2 parents 4fa383e + 7fae02f commit 5bffb09

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/AutolinkerSpec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,24 @@ describe( "Autolinker", function() {
486486
} );
487487

488488

489+
it( "should automatically link twitter handles surrounded by parentheses", function() {
490+
var result = Autolinker.link( "Joe's twitter is (@joe_the_man12)" );
491+
expect( result ).toBe( 'Joe\'s twitter is (<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>)' );
492+
} );
493+
494+
495+
it( "should automatically link twitter handles surrounded by braces", function() {
496+
var result = Autolinker.link( "Joe's twitter is {@joe_the_man12}" );
497+
expect( result ).toBe( 'Joe\'s twitter is {<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>}' );
498+
} );
499+
500+
501+
it( "should automatically link twitter handles surrounded by brackets", function() {
502+
var result = Autolinker.link( "Joe's twitter is [@joe_the_man12]" );
503+
expect( result ).toBe( 'Joe\'s twitter is [<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>]' );
504+
} );
505+
506+
489507
it( "should automatically link multiple twitter handles in a string", function() {
490508
var result = Autolinker.link( "@greg is tweeting @joe with @josh" );
491509
expect( result ).toBe( '<a href="https://twitter.com/greg" target="_blank">@greg</a> is tweeting <a href="https://twitter.com/joe" target="_blank">@joe</a> with <a href="https://twitter.com/josh" target="_blank">@josh</a>' );

0 commit comments

Comments
 (0)