Skip to content

Commit dffce1e

Browse files
committed
Add tests to ensure that '.'s in the path section of URLs are linked
1 parent ac906de commit dffce1e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/autolinker-url.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ describe( "Autolinker Url Matching -", () => {
180180
let result = autolinker.link( "Link: https://abc123def.org/-+&@#/%=~_()|\'$*[]?!:,.;/?param1=value-+&@#/%=~_()|\'$*[]?!:,.;#hash-+&@#/%=~_()|\'$*[]?!:,.;z" );
181181
expect( result ).toBe( 'Link: <a href="https://abc123def.org/-+&@#/%=~_()|\'$*[]?!:,.;/?param1=value-+&@#/%=~_()|\'$*[]?!:,.;#hash-+&@#/%=~_()|\'$*[]?!:,.;z">abc123def.org/-+&@#/%=~_()|\'$*[]?!:,.;/?param1=value-+&@#/%=~_()|\'$*[]?!:,.;#hash-+&@#/%=~_()|\'$*[]?!:,.;z</a>' );
182182
} );
183+
184+
185+
it( "should automatically link URLs with periods in the path", () => {
186+
const result1 = autolinker.link( 'https://images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg' );
187+
expect( result1 ).toBe( '<a href="https://images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg">images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg</a>' );
188+
189+
const result2 = autolinker.link( 'My image is at: https://images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg - check it out' );
190+
expect( result2 ).toBe( 'My image is at: <a href="https://images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg">images-na.ssl-images-amazon.com/images/I/912ozjp0ytL._SY450_.jpg</a> - check it out' );
191+
} );
183192

184193

185194
it( "should automatically link a URL with accented characters", function() {

0 commit comments

Comments
 (0)