source: tol/TolJava/WebTOLJavaDEMO/web/sh/tests/cases/011_smart_tabs.html @ 9887b93

1941-docker-image-to-testdevel
Last change on this file since 9887b93 was 9887b93, checked in by Humberto Carralero <hacarralero@…>, 15 years ago

Importing TolJava

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3900 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 2.0 KB
Line 
1<pre id="sh_011_smart_tabs_a" class="brush: plain;">
2        the             words   in              this    paragraph
3        should  look    like    they    are
4        evenly  spaced  between columns
5</pre>
6
7<pre id="sh_011_smart_tabs_b" class="brush: plain; tab-size: 8;">
8        the     words   in      this    paragraph
9        should  look    like    they    are
10        evenly  spaced  between columns
11</pre>
12
13<pre id="sh_011_smart_tabs_c" class="brush: plain; smart-tabs: false">
14        the             words   in              this    paragraph
15        should  look    out             of              whack
16        because smart   tabs    are             disabled
17</pre>
18
19<script type="text/javascript">
20queue(function()
21{
22        var $sh;
23       
24        module('011_smart_tabs');
25       
26        var evenLines = [
27                        'the     words   in      this    paragraph',
28                        'should  look    like    they    are',
29                        'evenly  spaced  between columns'
30                ],
31                unevenLines = [
32                        'the        words    in        this    paragraph',
33                        'should    look    out        of        whack',
34                        'because    smart    tabs    are        disabled'
35                ]
36                ;
37               
38        function fixSpaces(s)
39        {
40                s = encodeURIComponent(s).replace(/%C2%A0/g, '%20');
41                return unescape(s).replace(/\s+$/g, '');
42        };
43       
44        test('default tab size is 4', function()
45        {
46                $sh = $('#sh_011_smart_tabs_a');
47               
48                ok_sh($sh);
49                ok_toolbar($sh);
50                ok_code($sh);
51               
52                $sh.find('.code .line').each(function(index)
53                {
54                        var s1 = fixSpaces($(this).text()),
55                                s2 = fixSpaces(evenLines[index])
56                                ;
57                               
58                        equal(s1, s2, 'Line ' + index);
59                });
60        });
61
62        test('tab size changed to 8', function()
63        {
64                $sh = $('#sh_011_smart_tabs_b');
65               
66                ok_sh($sh);
67                ok_toolbar($sh);
68                ok_code($sh);
69               
70                $sh.find('.code .line').each(function(index)
71                {
72                        var s1 = fixSpaces($(this).text()),
73                                s2 = fixSpaces(evenLines[index])
74                                ;
75                               
76                        equal(s1, s2, 'Line ' + index);
77                });
78        });
79       
80        test('smart tabs are off', function()
81        {
82                $sh = $('#sh_011_smart_tabs_c');
83               
84                ok_sh($sh);
85                ok_toolbar($sh);
86                ok_code($sh);
87               
88                $sh.find('.code .line').each(function(index)
89                {
90                        var s1 = fixSpaces($(this).text()),
91                                s2 = fixSpaces(unevenLines[index])
92                                ;
93                               
94                        equal(s1, s2, 'Line ' + index);
95                });
96        });
97});
98</script>
Note: See TracBrowser for help on using the repository browser.