Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js |
— | — | @@ -279,6 +279,16 @@ |
280 | 280 | mw.test.addTest( 'typeof $.fn.makeCollapsible', |
281 | 281 | 'function (string)' ); |
282 | 282 | |
| 283 | + // Email validation |
| 284 | + // TODO: import tests from PHPUnit test suite |
| 285 | + mw.test.addHead( 'Email validation' ); |
| 286 | + |
| 287 | + mw.test.addTest( 'mw.util.validateEmail( "" )', |
| 288 | + 'null (object)' ); |
| 289 | + |
| 290 | + mw.test.addTest( 'mw.util.validateEmail( "user@localhost" )', |
| 291 | + 'true (boolean)' ); |
| 292 | + |
283 | 293 | // Run tests and compare results |
284 | 294 | var exec, |
285 | 295 | result, |
— | — | @@ -326,4 +336,4 @@ |
327 | 337 | |
328 | 338 | mediaWiki.test.init(); |
329 | 339 | |
330 | | -} )(jQuery, mediaWiki); |
\ No newline at end of file |
| 340 | +} )(jQuery, mediaWiki); |
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js |
— | — | @@ -501,8 +501,8 @@ |
502 | 502 | // Domain first part |
503 | 503 | '[' + rfc1034_ldh_str + ']+' |
504 | 504 | + |
505 | | - // Second part and following are separated by a dot |
506 | | - '(?:\\.[' + rfc1034_ldh_str + ']+)+' |
| 505 | + // Optional second part and following are separated by a dot |
| 506 | + '(?:\\.[' + rfc1034_ldh_str + ']+)*' |
507 | 507 | + |
508 | 508 | // End of string |
509 | 509 | '$', |