Make WordPress Core

Changeset 25275


Ignore:
Timestamp:
09/06/2013 10:56:01 AM (11 years ago)
Author:
SergeyBiryukov
Message:

Whitespace cleanup for password strength meter tests. props TobiasBg. fixes #25088.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/qunit/wp-admin/js/password-strength-meter.js

    r25175 r25275  
    1 jQuery(function() {
    2     module('password-strength-meter');
     1jQuery( function() {
     2    module( 'password-strength-meter' );
    33
    4     test('mismatched passwords should return 5', function(){
    5         equal( passwordStrength( 'password1',  'username', 'password2' ) , 5, 'mismatched passwords return 5');
     4    test( 'mismatched passwords should return 5', function() {
     5        equal( passwordStrength( 'password1', 'username', 'password2' ), 5, 'mismatched passwords return 5' );
    66    });
    77
    8     test('passwords shorter than 4 characters should return 0', function(){
    9         equal( passwordStrength( 'abc',  'username', 'abc' ) , 0, 'short passwords return 0');
     8    test( 'passwords shorter than 4 characters should return 0', function() {
     9        equal( passwordStrength( 'abc', 'username', 'abc' ), 0, 'short passwords return 0' );
    1010    });
    1111
    12     test('long complicated passwords should return 4', function(){
    13         var password = function( length ){
     12    test( 'long complicated passwords should return 4', function() {
     13        var password = function( length ) {
    1414            var possibility = 'abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
    15                 retVal = "";
    16             for (var i = 0, n = possibility.length; i < length; ++i) {
     15                retVal = '';
     16            for ( var i = 0, n = possibility.length; i < length; i++ ) {
    1717                retVal += possibility.charAt( Math.floor( Math.random() * n ) );
    1818            }
     
    2121        twofifty = password( 250 );
    2222
    23         equal( passwordStrength( twofifty , 'username', twofifty ), 4, '250 charachter complicated password returns 4');
     23        equal( passwordStrength( twofifty, 'username', twofifty ), 4, '250 character complicated password returns 4' );
    2424    });
    2525
    26     test('short uncomplicated passwords should return 0', function(){
     26    test( 'short uncomplicated passwords should return 0', function() {
    2727        var letters = 'aaaa',
    2828            numbers = '1111',
     
    3333        equal( passwordStrength( uppercase, 'username', uppercase ), 0, 'password of `' + uppercase + '` returns 0' );
    3434        equal( passwordStrength( password, 'username', password ), 0, 'password of `' + password + '` returns 0' );
    35     }); 
     35    });
    3636
    37     test('zxcvbn password tests should return the score we expect', function(){
     37    test( 'zxcvbn password tests should return the score we expect', function() {
    3838        var passwords = [
    39             { pw: 'zxcvbn', score: 0},
    40             { pw: 'qwER43@!', score: 1},
    41             { pw: 'Tr0ub4dour&3', score: 2},
    42             { pw: 'correcthorsebatterystaple', score: 4},
    43             { pw: 'coRrecth0rseba++ery9.23.2007staple$', score: 4},
    44             { pw: 'D0g..................', score: 0},
    45             { pw: 'abcdefghijk987654321', score: 0},
    46             { pw: 'neverforget13/3/1997', score: 2},
    47             { pw: '1qaz2wsx3edc', score: 0},
    48             { pw: 'temppass22', score: 1},
    49             { pw: 'briansmith', score: 0},
    50             { pw: 'briansmith4mayor', score: 0},
    51             { pw: 'password1', score: 0},
    52             { pw: 'viking', score: 0},
    53             { pw: 'thx1138', score: 0},
    54             { pw: 'ScoRpi0ns', score: 0},
    55             { pw: 'do you know', score: 0},
    56             { pw: 'ryanhunter2000', score: 0},
    57             { pw: 'rianhunter2000', score: 1},
    58             { pw: 'asdfghju7654rewq', score: 2},
    59             { pw: 'AOEUIDHG&*()LS_', score: 2},
    60             { pw: '12345678', score: 0},
    61             { pw: 'defghi6789', score: 0},
    62             { pw: 'rosebud', score: 0},
    63             { pw: 'Rosebud', score: 0},
    64             { pw: 'ROSEBUD', score: 0},
    65             { pw: 'rosebuD', score: 0},
    66             { pw: 'ros3bud99', score: 0},
    67             { pw: 'r0s3bud99', score: 0},
    68             { pw: 'R0$38uD99', score: 1},
    69             { pw: 'verlineVANDERMARK', score: 1},
    70             { pw: 'eheuczkqyq', score: 4},
    71             { pw: 'rWibMFACxAUGZmxhVncy', score: 4},
    72             { pw: 'Ba9ZyWABu99[BK#6MBgbH88Tofv)vs$w', score: 4}
     39            { pw: 'zxcvbn', score: 0 },
     40            { pw: 'qwER43@!', score: 1 },
     41            { pw: 'Tr0ub4dour&3', score: 2 },
     42            { pw: 'correcthorsebatterystaple', score: 4 },
     43            { pw: 'coRrecth0rseba++ery9.23.2007staple$', score: 4 },
     44            { pw: 'D0g..................', score: 0 },
     45            { pw: 'abcdefghijk987654321', score: 0 },
     46            { pw: 'neverforget13/3/1997', score: 2 },
     47            { pw: '1qaz2wsx3edc', score: 0 },
     48            { pw: 'temppass22', score: 1 },
     49            { pw: 'briansmith', score: 0 },
     50            { pw: 'briansmith4mayor', score: 0 },
     51            { pw: 'password1', score: 0 },
     52            { pw: 'viking', score: 0 },
     53            { pw: 'thx1138', score: 0 },
     54            { pw: 'ScoRpi0ns', score: 0 },
     55            { pw: 'do you know', score: 0 },
     56            { pw: 'ryanhunter2000', score: 0 },
     57            { pw: 'rianhunter2000', score: 1 },
     58            { pw: 'asdfghju7654rewq', score: 2 },
     59            { pw: 'AOEUIDHG&*()LS_', score: 2 },
     60            { pw: '12345678', score: 0 },
     61            { pw: 'defghi6789', score: 0 },
     62            { pw: 'rosebud', score: 0 },
     63            { pw: 'Rosebud', score: 0 },
     64            { pw: 'ROSEBUD', score: 0 },
     65            { pw: 'rosebuD', score: 0 },
     66            { pw: 'ros3bud99', score: 0 },
     67            { pw: 'r0s3bud99', score: 0 },
     68            { pw: 'R0$38uD99', score: 1 },
     69            { pw: 'verlineVANDERMARK', score: 1 },
     70            { pw: 'eheuczkqyq', score: 4 },
     71            { pw: 'rWibMFACxAUGZmxhVncy', score: 4 },
     72            { pw: 'Ba9ZyWABu99[BK#6MBgbH88Tofv)vs$w', score: 4 }
    7373        ];
    7474
    75         for (var i=0; i < passwords.length; i++) {
    76             equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns '+passwords[i].score );
     75        for ( var i = 0; i < passwords.length; i++ ) {
     76            equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns ' + passwords[i].score );
    7777        }
    7878    });
     
    8888
    8989        ok( penalizedPasswordScore < allowedPasswordScore, 'Penalized password scored ' + penalizedPasswordScore + '; allowed password scored: ' + allowedPasswordScore );
    90     } );
     90    });
    9191});
Note: See TracChangeset for help on using the changeset viewer.