File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 104104 */
105105angular . module ( 'ngSanitize' ) . filter ( 'linky' , [ '$sanitize' , function ( $sanitize ) {
106106 var LINKY_URL_REGEXP =
107- / ( ( f t p | h t t p s ? ) : \/ \/ | ( w w w \. ) | ( m a i l t o : ) ? [ A - Z a - z 0 - 9 . _ % + - ] + @ ) \S * [ ^ \s . ; , ( ) { } < > " ” ’ ] / ,
108- MAILTO_REGEXP = / ^ m a i l t o : / ;
107+ / ( ( f t p | h t t p s ? ) : \/ \/ | ( w w w \. ) | ( m a i l t o : ) ? [ A - Z a - z 0 - 9 . _ % + - ] + @ ) \S * [ ^ \s . ; , ( ) { } < > " ” ’ ] / i ,
108+ MAILTO_REGEXP = / ^ m a i l t o : / i ;
109109
110110 return function ( text , target ) {
111111 if ( ! text ) return text ;
Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ describe('linky', function() {
2020 expect ( linky ( undefined ) ) . not . toBeDefined ( ) ;
2121 } ) ;
2222
23+ it ( 'should be case-insensitive' , function ( ) {
24+ expect ( linky ( 'WWW.example.com' ) ) . toEqual ( '<a href="http://WWW.example.com">WWW.example.com</a>' ) ;
25+ expect ( linky ( 'WWW.EXAMPLE.COM' ) ) . toEqual ( '<a href="http://WWW.EXAMPLE.COM">WWW.EXAMPLE.COM</a>' ) ;
26+ expect ( linky ( 'HTTP://www.example.com' ) ) . toEqual ( '<a href="HTTP://www.example.com">HTTP://www.example.com</a>' ) ;
27+ expect ( linky ( 'HTTP://example.com' ) ) . toEqual ( '<a href="HTTP://example.com">HTTP://example.com</a>' ) ;
28+ expect ( linky ( 'HTTPS://www.example.com' ) ) . toEqual ( '<a href="HTTPS://www.example.com">HTTPS://www.example.com</a>' ) ;
29+ expect ( linky ( 'HTTPS://example.com' ) ) . toEqual ( '<a href="HTTPS://example.com">HTTPS://example.com</a>' ) ;
30+ } ) ;
31+
2332 it ( 'should handle www.' , function ( ) {
2433 expect ( linky ( 'www.example.com' ) ) . toEqual ( '<a href="http://www.example.com">www.example.com</a>' ) ;
2534 } ) ;
You can’t perform that action at this time.
0 commit comments