1<pre id="sh_010_highlight_a" class="brush: groovy; highlight: 2"> 2 public function validateStrongPassword(password:String):Boolean 3 { 4 if (password == null || password.length <= 0) 5 { 6 return false; 7 } 8 9 return STRONG_PASSWORD_PATTERN.test(password); 10 } 11</pre> 12<script id="sh_010_highlight_b" type="syntaxhighlighter" class="brush: as3; highlight: [2, 4, 12]"><![CDATA[ 13 /** 14 * Checks a password and returns a value indicating whether the password is a "strong" 15 * password. The criteria for a strong password are: 16 * 17 * <ul> 18 * <li>Minimum 8 characters</li> 19 * <li>Maxmium 32 characters</li> 20 * <li>Contains at least one lowercase letter</li> 21 * <li>Contains at least one uppercase letter</li> 22 * <li>Contains at least one number or symbol character</li> 23 * </ul> 24 * 25 * @param password The password to check 26 * 27 * @return A value indicating whether the password is a strong password (<code>true</code>) 28 * or not (<code>false</code>). 29 */ 30 public function validateStrongPassword(password:String):Boolean 31 { 32 if (password == null || password.length <= 0) 33 { 34 return false; 35 } 36 37 return STRONG_PASSWORD_PATTERN.test(password); 38 } 39]]></script> 40 41<script type="text/javascript"> 42queue(function() 43{ 44 var $sh; 45 46 module('010_highlight'); 47 48 test('one highlighted line', function() 49 { 50 $sh = $('#sh_010_highlight_a'); 51 52 ok_sh($sh); 53 ok_toolbar($sh); 54 ok_code($sh); 55 ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted'); 56 }); 57 58 test('multiple highlighted lines', function() 59 { 60 $sh = $('#sh_010_highlight_b'); 61 62 ok_sh($sh); 63 ok_toolbar($sh); 64 ok_code($sh); 65 ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted'); 66 ok($sh.find('.gutter .number4').is('.highlighted'), 'Line 4 is highlighted'); 67 ok($sh.find('.gutter .number12').is('.highlighted'), 'Line 12 is highlighted'); 68 }); 69}); 70</script> 71