@@ -185,9 +185,9 @@ describe( "Autolinker", function() {
185
185
} ) ;
186
186
187
187
188
- it ( "should autolink protocols with at least two characters " , function ( ) {
189
- var result = autolinker . link ( 'link this: gg ://example.com/' ) ;
190
- expect ( result ) . toBe ( 'link this: <a href="gg ://example.com/">gg ://example.com</a>' ) ;
188
+ it ( "should autolink protocols with at least one character " , function ( ) {
189
+ var result = autolinker . link ( 'link this: g ://example.com/' ) ;
190
+ expect ( result ) . toBe ( 'link this: <a href="g ://example.com/">g ://example.com</a>' ) ;
191
191
} ) ;
192
192
193
193
@@ -197,12 +197,6 @@ describe( "Autolinker", function() {
197
197
} ) ;
198
198
199
199
200
- it ( "should NOT autolink a protocol with only one character" , function ( ) {
201
- var result = autolinker . link ( 'do not link this: a://example' ) ;
202
- expect ( result ) . toBe ( 'do not link this: a://example' ) ;
203
- } ) ;
204
-
205
-
206
200
it ( "should autolink protocols with digits, dashes, dots, and plus signs in their names" , function ( ) {
207
201
var result1 = autolinker . link ( 'link this: a1://example' ) ;
208
202
expect ( result1 ) . toBe ( 'link this: <a href="a1://example">a1://example</a>' ) ;
@@ -223,17 +217,20 @@ describe( "Autolinker", function() {
223
217
224
218
225
219
it ( "should NOT autolink protocols that start with a digit, dash, plus sign, or dot, as per http://tools.ietf.org/html/rfc3986#section-3.1" , function ( ) {
226
- var result = autolinker . link ( 'do not link this: 1a://example' ) ;
227
- expect ( result ) . toBe ( 'do not link this: 1a://example' ) ;
220
+ var result = autolinker . link ( 'do not link first char: 1a://example' ) ;
221
+ expect ( result ) . toBe ( 'do not link first char: 1<a href="a://example">a://example</a>' ) ;
222
+
223
+ var result2 = autolinker . link ( 'do not link first char: -a://example' ) ;
224
+ expect ( result2 ) . toBe ( 'do not link first char: -<a href="a://example">a://example</a>' ) ;
228
225
229
- var result2 = autolinker . link ( 'do not link this: - a://example' ) ;
230
- expect ( result2 ) . toBe ( 'do not link this: -a ://example' ) ;
226
+ var result3 = autolinker . link ( 'do not link first char: + a://example' ) ;
227
+ expect ( result3 ) . toBe ( 'do not link first char: +<a href="a ://example">a://example</a> ' ) ;
231
228
232
- var result3 = autolinker . link ( 'do not link this: + a://example' ) ;
233
- expect ( result3 ) . toBe ( 'do not link this: +a ://example' ) ;
229
+ var result4 = autolinker . link ( 'do not link first char: . a://example' ) ;
230
+ expect ( result4 ) . toBe ( 'do not link first char: .<a href="a ://example">a://example</a> ' ) ;
234
231
235
- var result4 = autolinker . link ( 'do not link this : .a ://example' ) ;
236
- expect ( result4 ) . toBe ( 'do not link this : .a ://example' ) ;
232
+ var result5 = autolinker . link ( 'do not link first char : .aa ://example' ) ;
233
+ expect ( result5 ) . toBe ( 'do not link first char : .<a href="aa ://example">aa://example</a> ' ) ;
237
234
} ) ;
238
235
239
236
0 commit comments