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