diff options
author | JinweiClarkChao <[email protected]> | 2014-09-23 22:34:14 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:44 +0800 |
commit | b214f38d2c24a890ce36512a0c8bab965e27a508 (patch) | |
tree | 1522b651444407cbf120798e79be4657f1b472ab /Code/Blocks/syntax/tests/cases/011_smart_tabs.html | |
parent | e13882d1656b143533cec307a19425e0a56ec999 (diff) | |
download | jinwei.me-b214f38d2c24a890ce36512a0c8bab965e27a508.tar.gz |
README
Diffstat (limited to 'Code/Blocks/syntax/tests/cases/011_smart_tabs.html')
-rw-r--r-- | Code/Blocks/syntax/tests/cases/011_smart_tabs.html | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/Code/Blocks/syntax/tests/cases/011_smart_tabs.html b/Code/Blocks/syntax/tests/cases/011_smart_tabs.html new file mode 100644 index 0000000..d6d62fc --- /dev/null +++ b/Code/Blocks/syntax/tests/cases/011_smart_tabs.html | |||
@@ -0,0 +1,98 @@ | |||
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"> | ||
20 | queue(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> | ||