diff options
author | JinweiClarkChao <[email protected]> | 2014-08-22 17:23:02 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:42 +0800 |
commit | 80255411ee7040e0cebbf6b05d2ce323f6f2596e (patch) | |
tree | 295b0ef6c85e7cb091b63719ab041596879690fa /Blocks/syntax/tests/cases/011_smart_tabs.html | |
parent | 13be3d058713e1467ffc573a90cc694b80526135 (diff) | |
download | jinwei.me-80255411ee7040e0cebbf6b05d2ce323f6f2596e.tar.gz |
backup
Diffstat (limited to 'Blocks/syntax/tests/cases/011_smart_tabs.html')
-rw-r--r-- | Blocks/syntax/tests/cases/011_smart_tabs.html | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/Blocks/syntax/tests/cases/011_smart_tabs.html b/Blocks/syntax/tests/cases/011_smart_tabs.html deleted file mode 100644 index d6d62fc..0000000 --- a/Blocks/syntax/tests/cases/011_smart_tabs.html +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
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> | ||