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_014_legacy_a" name="code" class="plain">basic check</pre>
<pre id="sh_014_legacy_b" name="code" class="plain:nocontrols">no toolbar</pre>
<pre id="sh_014_legacy_c" name="code" class="plain:nogutter">no gutter</pre>
<pre id="sh_014_legacy_d" name="code" class="plain:collapse">collapsed</pre>
<pre id="sh_014_legacy_e" name="code" class="plain:firstline[10]">first line</pre>
 
<script type="text/javascript">
queue(function()
{
    var $sh;
    
    dp.SyntaxHighlighter.HighlightAll('code');
    
    module('014_legacy');
    
    test('basic check', function() 
    {
        $sh = $('#sh_014_legacy_a');
        
        ok_sh($sh);
        ok_toolbar($sh);
        ok_code($sh);
    });
 
    test('no toolbar', function() 
    {
        $sh = $('#sh_014_legacy_b');
        
        ok_sh($sh);
        ok_code($sh);
        ok($sh.find('> .syntaxhighlighter > .toolbar').length == 0, 'Toolbar not present');
    });
    
    test('no gutter', function() 
    {
        $sh = $('#sh_014_legacy_c');
        
        ok_sh($sh);
        ok_toolbar($sh);
        ok_code($sh);
        
        ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present');
        ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present');
    });
    
    test('collapsed check', function()
    {
        $sh = $('#sh_014_legacy_d');
        
        ok_sh($sh);
        ok_toolbar($sh);
        ok_collapsed($sh);
        
        var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource');
        ok($title.length == 1, 'Expand present');
        equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text');
    });
    
    test('first line check', function()
    {
        $sh = $('#sh_014_legacy_e');
        
        ok_sh($sh);
        ok_toolbar($sh);
        ok_gutter($sh);
        ok_code($sh);
        equals($sh.find('.gutter .index0').text(), '10', 'First line');
    });
});
</script>