@@ -61,6 +61,36 @@ describe( "Autolinker", function() {
61
61
} ) ;
62
62
63
63
64
+ it ( "should automatically link URLs with a port number" , function ( ) {
65
+ var result = autolinker . link ( "Joe went to http://yahoo.com:8000 today." ) ;
66
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000">yahoo.com:8000</a> today.' ) ;
67
+ } ) ;
68
+
69
+
70
+ it ( "should automatically link URLs with a port number and a following slash" , function ( ) {
71
+ var result = autolinker . link ( "Joe went to http://yahoo.com:8000/ today." ) ;
72
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000/">yahoo.com:8000</a> today.' ) ;
73
+ } ) ;
74
+
75
+
76
+ it ( "should automatically link URLs with a port number and a path" , function ( ) {
77
+ var result = autolinker . link ( "Joe went to http://yahoo.com:8000/mysite/page today." ) ;
78
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000/mysite/page">yahoo.com:8000/mysite/page</a> today.' ) ;
79
+ } ) ;
80
+
81
+
82
+ it ( "should automatically link URLs with a port number and a query string" , function ( ) {
83
+ var result = autolinker . link ( "Joe went to http://yahoo.com:8000?page=index today." ) ;
84
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000?page=index">yahoo.com:8000?page=index</a> today.' ) ;
85
+ } ) ;
86
+
87
+
88
+ it ( "should automatically link URLs with a port number and a hash string" , function ( ) {
89
+ var result = autolinker . link ( "Joe went to http://yahoo.com:8000#page=index today." ) ;
90
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000#page=index">yahoo.com:8000#page=index</a> today.' ) ;
91
+ } ) ;
92
+
93
+
64
94
it ( "should NOT automatically link strings of the form 'git:d' (using the heuristic that the domain name does not have a '.' in it)" , function ( ) {
65
95
var result = autolinker . link ( 'Something like git:d should not be linked as a URL' ) ;
66
96
expect ( result ) . toBe ( 'Something like git:d should not be linked as a URL' ) ;
@@ -121,6 +151,12 @@ describe( "Autolinker", function() {
121
151
expect ( result ) . toBe ( 'Joe went to <a href="http://www.yahoo.com">yahoo.com</a>.' ) ;
122
152
} ) ;
123
153
154
+
155
+ it ( "should automatically link URLs in the form of 'www.yahoo.com:8000' (with a port number)" , function ( ) {
156
+ var result = autolinker . link ( "Joe went to www.yahoo.com:8000 today" ) ;
157
+ expect ( result ) . toBe ( 'Joe went to <a href="http://www.yahoo.com:8000">yahoo.com:8000</a> today' ) ;
158
+ } ) ;
159
+
124
160
} ) ;
125
161
126
162
@@ -155,6 +191,12 @@ describe( "Autolinker", function() {
155
191
expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com">yahoo.com</a>.' ) ;
156
192
} ) ;
157
193
194
+
195
+ it ( "should automatically link URLs in the form of 'www.yahoo.com:8000' (with a port number)" , function ( ) {
196
+ var result = autolinker . link ( "Joe went to yahoo.com:8000 today" ) ;
197
+ expect ( result ) . toBe ( 'Joe went to <a href="http://yahoo.com:8000">yahoo.com:8000</a> today' ) ;
198
+ } ) ;
199
+
158
200
} ) ;
159
201
160
202
0 commit comments