Ticket #25187: 25187.13.diff
File 25187.13.diff, 1.4 KB (added by , 11 years ago) |
---|
-
tests/qunit/wp-admin/js/password-strength-meter.js
13 13 test( 'long complicated passwords should return 4', function() { 14 14 var password = function( length ) { 15 15 var possibility = 'abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', 16 retVal = ''; 17 for ( var i = 0, n = possibility.length; i < length; i++ ) { 16 retVal = '', 17 i, 18 n; 19 for ( i = 0, n = possibility.length; i < length; i++ ) { 18 20 retVal += possibility.charAt( Math.floor( Math.random() * n ) ); 19 21 } 20 22 return retVal + 'aB2'; // add a lower case, uppercase and number just to make sure we always have one of each … … 36 38 }); 37 39 38 40 test( 'zxcvbn password tests should return the score we expect', function() { 39 var passwords = [ 41 var passwords, 42 i; 43 passwords = [ 40 44 { pw: 'zxcvbn', score: 0 }, 41 45 { pw: 'qwER43@!', score: 1 }, 42 46 { pw: 'Tr0ub4dour&3', score: 2 }, … … 73 77 { pw: 'Ba9ZyWABu99[BK#6MBgbH88Tofv)vs$w', score: 4 } 74 78 ]; 75 79 76 for ( vari = 0; i < passwords.length; i++ ) {80 for ( i = 0; i < passwords.length; i++ ) { 77 81 equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns ' + passwords[i].score ); 78 82 } 79 83 });