This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 104
104
*/
105
105
angular . module ( 'ngSanitize' ) . filter ( 'linky' , [ '$sanitize' , function ( $sanitize ) {
106
106
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 ;
109
109
110
110
return function ( text , target ) {
111
111
if ( ! text ) return text ;
Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ describe('linky', function() {
20
20
expect ( linky ( undefined ) ) . not . toBeDefined ( ) ;
21
21
} ) ;
22
22
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
+
23
32
it ( 'should handle www.' , function ( ) {
24
33
expect ( linky ( 'www.example.com' ) ) . toEqual ( '<a href="http://www.example.com">www.example.com</a>' ) ;
25
34
} ) ;
You can’t perform that action at this time.
0 commit comments