Skip to content

Commit 7fae02f

Browse files
committed
add tests for twitter handles surrounded by parens, braces, or brackets
1 parent be47aba commit 7fae02f

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
@@ -478,6 +478,24 @@ describe( "Autolinker", function() {
478478
} );
479479

480480

481+
it( "should automatically link twitter handles surrounded by parentheses", function() {
482+
var result = Autolinker.link( "Joe's twitter is (@joe_the_man12)" );
483+
expect( result ).toBe( 'Joe\'s twitter is (<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>)' );
484+
} );
485+
486+
487+
it( "should automatically link twitter handles surrounded by braces", function() {
488+
var result = Autolinker.link( "Joe's twitter is {@joe_the_man12}" );
489+
expect( result ).toBe( 'Joe\'s twitter is {<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>}' );
490+
} );
491+
492+
493+
it( "should automatically link twitter handles surrounded by brackets", function() {
494+
var result = Autolinker.link( "Joe's twitter is [@joe_the_man12]" );
495+
expect( result ).toBe( 'Joe\'s twitter is [<a href="https://twitter.com/joe_the_man12" target="_blank">@joe_the_man12</a>]' );
496+
} );
497+
498+
481499
it( "should automatically link multiple twitter handles in a string", function() {
482500
var result = Autolinker.link( "@greg is tweeting @joe with @josh" );
483501
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)