aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinweiClarkChao <[email protected]>2014-08-22 17:23:02 +0800
committerJinwei Zhao <[email protected]>2017-01-13 15:07:42 +0800
commit80255411ee7040e0cebbf6b05d2ce323f6f2596e (patch)
tree295b0ef6c85e7cb091b63719ab041596879690fa /Blocks/syntax/tests/cases
parent13be3d058713e1467ffc573a90cc694b80526135 (diff)
downloadjinwei.me-80255411ee7040e0cebbf6b05d2ce323f6f2596e.tar.gz
backup
Diffstat (limited to 'Blocks/syntax/tests/cases')
-rw-r--r--Blocks/syntax/tests/cases/001_basic.html42
-rw-r--r--Blocks/syntax/tests/cases/002_brushes.html50
-rw-r--r--Blocks/syntax/tests/cases/003_script_tag.html42
-rw-r--r--Blocks/syntax/tests/cases/004_url_parsing.html43
-rw-r--r--Blocks/syntax/tests/cases/005_no_gutter.html33
-rw-r--r--Blocks/syntax/tests/cases/006_pad_line_numbers.html39
-rw-r--r--Blocks/syntax/tests/cases/007_collapse.html60
-rw-r--r--Blocks/syntax/tests/cases/007_collapse_interaction.html44
-rw-r--r--Blocks/syntax/tests/cases/008_first_line.html29
-rw-r--r--Blocks/syntax/tests/cases/009_class_name.html32
-rw-r--r--Blocks/syntax/tests/cases/010_highlight.html70
-rw-r--r--Blocks/syntax/tests/cases/011_smart_tabs.html98
-rw-r--r--Blocks/syntax/tests/cases/012_server_side.html35
-rw-r--r--Blocks/syntax/tests/cases/013_html_script.html34
-rw-r--r--Blocks/syntax/tests/cases/014_legacy.html70
15 files changed, 0 insertions, 721 deletions
diff --git a/Blocks/syntax/tests/cases/001_basic.html b/Blocks/syntax/tests/cases/001_basic.html
deleted file mode 100644
index 1d57334..0000000
--- a/Blocks/syntax/tests/cases/001_basic.html
+++ /dev/null
@@ -1,42 +0,0 @@
1<pre id="sh_001_basic" class="brush: js;" title="Title/caption should render">
2 /**
3 * multiline comment
4 */
5
6 text
7
8 // single line comment
9
10 text
11
12 "string" text 'string' text "string"
13 "string with \" escape" text 'string with \' escape' text "string with \" escape"
14
15 var code = '\
16 function helloWorld()\
17 {\
18 // this is great!\
19 for(var i = 0; i &lt;= 1; i++)\
20 alert("yay");\
21 }\
22 ';
23</pre>
24
25<script type="text/javascript">
26queue(function()
27{
28 var $sh;
29
30 module('001_basic');
31
32 test('basic html check of default elements', function()
33 {
34 $sh = $('#sh_001_basic');
35 ok_sh($sh);
36 ok_toolbar($sh);
37 ok_caption($sh, 'Title/caption should render');
38 ok_gutter($sh);
39 ok_code($sh);
40 });
41});
42</script>
diff --git a/Blocks/syntax/tests/cases/002_brushes.html b/Blocks/syntax/tests/cases/002_brushes.html
deleted file mode 100644
index e9c64e2..0000000
--- a/Blocks/syntax/tests/cases/002_brushes.html
+++ /dev/null
@@ -1,50 +0,0 @@
1<div id="sh_002_brushes">
2 <pre class="brush: applescript;">test</pre>
3 <pre class="brush: as3;">test</pre>
4 <pre class="brush: bash;">test</pre>
5 <pre class="brush: cf;">test</pre>
6 <pre class="brush: cpp;">test</pre>
7 <pre class="brush: csharp;">test</pre>
8 <pre class="brush: css;">test</pre>
9 <pre class="brush: delphi;">test</pre>
10 <pre class="brush: diff;">test</pre>
11 <pre class="brush: erlang;">test</pre>
12 <pre class="brush: groovy;">test</pre>
13 <pre class="brush: java;">test</pre>
14 <pre class="brush: javafx;">test</pre>
15 <pre class="brush: jscript;">test</pre>
16 <pre class="brush: perl;">test</pre>
17 <pre class="brush: php;">test</pre>
18 <pre class="brush: plain;">test</pre>
19 <pre class="brush: powershell;">test</pre>
20 <pre class="brush: python;">test</pre>
21 <pre class="brush: ruby;">test</pre>
22 <pre class="brush: sass;">test</pre>
23 <pre class="brush: scala;">test</pre>
24 <pre class="brush: sql;">test</pre>
25 <pre class="brush: vb;">test</pre>
26 <pre class="brush: xml;">test</pre>
27</div>
28
29<script type="text/javascript">
30queue(function()
31{
32 var $sh;
33
34 module('002_brushes');
35
36 test('check that all brushes loaded and rendered', function()
37 {
38 $sh = $('#sh_002_brushes');
39
40 $sh.find('> div > .syntaxhighlighter').each(function()
41 {
42 var $sh = $(this).parent();
43 ok_sh($sh);
44 ok_sh($sh);
45 ok_toolbar($sh);
46 ok_code($sh);
47 });
48 });
49});
50</script>
diff --git a/Blocks/syntax/tests/cases/003_script_tag.html b/Blocks/syntax/tests/cases/003_script_tag.html
deleted file mode 100644
index 9b44292..0000000
--- a/Blocks/syntax/tests/cases/003_script_tag.html
+++ /dev/null
@@ -1,42 +0,0 @@
1<div>
2<script id="sh_003_script_tag" type="syntaxhighlighter" class="brush: csharp" title="Title/caption should render"><![CDATA[
3 partial class Foo
4 {
5 function test()
6 {
7 yield return;
8 yield break;
9 }
10 }
11
12 function foo()
13 {
14 var vector:Vector.<Vector.<String>> = new Vector<Vector.String>>();
15
16 for (var i = 0; i < 10; i++)
17 {
18 /* comments */
19 }
20 }
21]]></script>
22</div>
23
24<script type="text/javascript">
25queue(function()
26{
27 var $sh;
28
29 module('003_script_tag');
30
31 test('basic html check of default elements', function()
32 {
33 $sh = $('#sh_003_script_tag');
34
35 ok_sh($sh);
36 ok_toolbar($sh);
37 ok_caption($sh, 'Title/caption should render');
38 ok_gutter($sh);
39 ok_code($sh);
40 });
41});
42</script>
diff --git a/Blocks/syntax/tests/cases/004_url_parsing.html b/Blocks/syntax/tests/cases/004_url_parsing.html
deleted file mode 100644
index d489a66..0000000
--- a/Blocks/syntax/tests/cases/004_url_parsing.html
+++ /dev/null
@@ -1,43 +0,0 @@
1<pre id="sh_004_url_parsing" class="brush: as3;">
2/**
3 * Please see &lt;http://www.alexgorbatchev.come/?test=1&y=2&gt;
4 */
5var home = "http://www.alexgorbatchev.come/?test=1&y=2;test/1/2/3;";
6// &lt; http://www.gnu.org/licenses/?test=1&y=2 &gt;.
7
8// Test embedded URLs that terminate at a left angle bracket.
9// See bug #28: http://bitbucket.org/alexg/syntaxhighlighter/issue/28/
10"<location>http://www.example.com/song2.mp3</location>";
11</pre>
12
13<script type="text/javascript">
14queue(function()
15{
16 var $sh;
17
18 module('004_url_parsing');
19
20 test('check that urls are present', function()
21 {
22 $sh = $('#sh_004_url_parsing');
23
24 ok_sh($sh);
25 ok_toolbar($sh);
26 ok_code($sh);
27
28 var expected = [
29 'http://www.alexgorbatchev.come/?test=1&y=2',
30 'http://www.alexgorbatchev.come/?test=1&y=2;test/1/2/3;',
31 'http://www.gnu.org/licenses/?test=1&y=2',
32 'http://bitbucket.org/alexg/syntaxhighlighter/issue/28/',
33 'http://www.example.com/song2.mp3'
34 ];
35
36 $sh.find('td.code a').each(function(index)
37 {
38 equal($(this).attr('href'), expected[index], 'href');
39 equal($(this).text(), expected[index], 'text');
40 })
41 });
42});
43</script> \ No newline at end of file
diff --git a/Blocks/syntax/tests/cases/005_no_gutter.html b/Blocks/syntax/tests/cases/005_no_gutter.html
deleted file mode 100644
index 6e6b1be..0000000
--- a/Blocks/syntax/tests/cases/005_no_gutter.html
+++ /dev/null
@@ -1,33 +0,0 @@
1<pre id="sh_005_no_gutter" class="brush: java; gutter: false;">
2 public Image getImage(URL url, String name) {
3 try {
4 /*
5 Regular multiline comment.
6 */
7 return getImage(new URL(url, name));
8 } catch (MalformedURLException e) {
9 return null;
10 }
11 }
12</pre>
13
14<script type="text/javascript">
15queue(function()
16{
17 var $sh;
18
19 module('005_no_gutter');
20
21 test('check that there is no gutter', function()
22 {
23 $sh = $('#sh_005_no_gutter');
24
25 ok_sh($sh);
26 ok_toolbar($sh);
27 ok_code($sh);
28
29 ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present');
30 ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present');
31 });
32});
33</script>
diff --git a/Blocks/syntax/tests/cases/006_pad_line_numbers.html b/Blocks/syntax/tests/cases/006_pad_line_numbers.html
deleted file mode 100644
index 8ebdd55..0000000
--- a/Blocks/syntax/tests/cases/006_pad_line_numbers.html
+++ /dev/null
@@ -1,39 +0,0 @@
1<pre id="sh_006_pad_line_numbers" class="brush: java; pad-line-numbers: true">
2/**
3 * Returns an Image object that can then be painted on the screen.
4 * The url argument must specify an absolute {@link URL}. The name
5 * argument is a specifier that is relative to the url argument.
6 *
7 * @param url an absolute URL giving the base location of the image
8 * @param name the location of the image, relative to the url argument
9 * @return the image at the specified URL
10 * @see Image
11 */
12</pre>
13
14<script type="text/javascript">
15queue(function()
16{
17 var $sh;
18
19 module('006_pad_line_numbers');
20
21 test('check that line numbers are padded with zeroes', function()
22 {
23 $sh = $('#sh_006_pad_line_numbers');
24
25 ok_sh($sh);
26 ok_toolbar($sh);
27 ok_gutter($sh);
28 ok_code($sh);
29
30 $sh.find('.gutter > .line').each(function(index)
31 {
32 var text = $(this).text();
33
34 if (parseInt(text) < 10)
35 ok(text.charAt(0) == '0', 'Line ' + index + ' has leading zero: ' + text);
36 });
37 });
38});
39</script>
diff --git a/Blocks/syntax/tests/cases/007_collapse.html b/Blocks/syntax/tests/cases/007_collapse.html
deleted file mode 100644
index 2643bb5..0000000
--- a/Blocks/syntax/tests/cases/007_collapse.html
+++ /dev/null
@@ -1,60 +0,0 @@
1<pre id="sh_007_collapse_a" class="brush: groovy; collapse: true" title="This is a title for collapsed block">
2 /**
3 * Returns an Image object that can then be painted on the screen.
4 * The url argument must specify an absolute {@link URL}. The name
5 * argument is a specifier that is relative to the url argument.
6 *
7 * @param url an absolute URL giving the base location of the image
8 * @param name the location of the image, relative to the url argument
9 * @return the image at the specified URL
10 * @see Image
11 */
12</pre>
13
14<pre id="sh_007_collapse_b" class="brush: groovy; collapse: true">
15 /**
16 * Returns an Image object that can then be painted on the screen.
17 * The url argument must specify an absolute {@link URL}. The name
18 * argument is a specifier that is relative to the url argument.
19 *
20 * @param url an absolute URL giving the base location of the image
21 * @param name the location of the image, relative to the url argument
22 * @return the image at the specified URL
23 * @see Image
24 */
25</pre>
26
27<script type="text/javascript">
28queue(function()
29{
30 var $sh;
31
32 module('007_collapse');
33
34 test('collapsed block with title', function()
35 {
36 $sh = $('#sh_007_collapse_a');
37
38 ok_sh($sh);
39 ok_toolbar($sh);
40 ok_collapsed($sh);
41
42 var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource');
43 ok($title.length == 1, 'Expand present');
44 equal($title.text(), 'This is a title for collapsed block', 'Expand text');
45 });
46
47 test('collapsed block without title', function()
48 {
49 $sh = $('#sh_007_collapse_b');
50
51 ok_sh($sh);
52 ok_toolbar($sh);
53 ok_collapsed($sh);
54
55 var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource');
56 ok($title.length == 1, 'Expand present');
57 equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text');
58 });
59});
60</script>
diff --git a/Blocks/syntax/tests/cases/007_collapse_interaction.html b/Blocks/syntax/tests/cases/007_collapse_interaction.html
deleted file mode 100644
index ea72046..0000000
--- a/Blocks/syntax/tests/cases/007_collapse_interaction.html
+++ /dev/null
@@ -1,44 +0,0 @@
1<script type="text/javascript">
2queue(function()
3{
4 var $sh;
5
6 module('007_collapse_interaction');
7
8 function clickA($a)
9 {
10 SyntaxHighlighter.toolbar.handler({
11 target: $a[0],
12 preventDefault: function() {}
13 });
14 };
15
16 test('expand collapsed block with title', function()
17 {
18 $sh = $('#sh_007_collapse_a');
19
20 ok_sh($sh);
21 ok_toolbar($sh);
22 ok_collapsed($sh);
23
24 var $a = $sh.find('.toolbar a.toolbar_item.command_expandSource');
25 clickA($a);
26 ok($a.not(':visible'), 'Expand not visible');
27 ok_code($sh);
28 });
29
30 test('expand collapsed block without title', function()
31 {
32 $sh = $('#sh_007_collapse_b');
33
34 ok_sh($sh);
35 ok_toolbar($sh);
36 ok_collapsed($sh);
37
38 var $a = $sh.find('.toolbar a.toolbar_item.command_expandSource');
39 clickA($a);
40 ok($a.not(':visible'), 'Expand not visible');
41 ok_code($sh);
42 });
43});
44</script>
diff --git a/Blocks/syntax/tests/cases/008_first_line.html b/Blocks/syntax/tests/cases/008_first_line.html
deleted file mode 100644
index 169dc38..0000000
--- a/Blocks/syntax/tests/cases/008_first_line.html
+++ /dev/null
@@ -1,29 +0,0 @@
1<pre id="sh_008_first_line" class="brush: java; first-line: 10">
2 partial class Foo
3 {
4 function test()
5 {
6 yield return;
7 }
8 }
9</pre>
10
11<script type="text/javascript">
12queue(function()
13{
14 var $sh;
15
16 module('008_first_line');
17
18 test('check the first line', function()
19 {
20 $sh = $('#sh_008_first_line');
21
22 ok_sh($sh);
23 ok_toolbar($sh);
24 ok_gutter($sh);
25 ok_code($sh);
26 equals($sh.find('.gutter .index0').text(), '10', 'First line');
27 });
28});
29</script>
diff --git a/Blocks/syntax/tests/cases/009_class_name.html b/Blocks/syntax/tests/cases/009_class_name.html
deleted file mode 100644
index f2437d5..0000000
--- a/Blocks/syntax/tests/cases/009_class_name.html
+++ /dev/null
@@ -1,32 +0,0 @@
1<pre id="sh_009_class_name" class="brush: java; class-name: 'custom class here'">
2 public Image getImage(URL url, String name) {
3 try {
4 /*
5 Regular multiline comment.
6 */
7 return getImage(new URL(url, name));
8 } catch (MalformedURLException e) {
9 return null;
10 }
11 }
12</pre>
13
14<script type="text/javascript">
15queue(function()
16{
17 var $sh;
18
19 module('009_class_name');
20
21 test('check custom classes', function()
22 {
23 $sh = $('#sh_009_class_name');
24
25 ok_sh($sh);
26 ok_toolbar($sh);
27 ok_gutter($sh);
28 ok_code($sh);
29 ok($sh.find('.syntaxhighlighter').is('.custom.class.here'), 'Check custom classes');
30 });
31});
32</script>
diff --git a/Blocks/syntax/tests/cases/010_highlight.html b/Blocks/syntax/tests/cases/010_highlight.html
deleted file mode 100644
index 64b6613..0000000
--- a/Blocks/syntax/tests/cases/010_highlight.html
+++ /dev/null
@@ -1,70 +0,0 @@
1<pre id="sh_010_highlight_a" class="brush: groovy; highlight: 2">
2 public function validateStrongPassword(password:String):Boolean
3 {
4 if (password == null || password.length <= 0)
5 {
6 return false;
7 }
8
9 return STRONG_PASSWORD_PATTERN.test(password);
10 }
11</pre>
12<script id="sh_010_highlight_b" type="syntaxhighlighter" class="brush: as3; highlight: [2, 4, 12]"><![CDATA[
13 /**
14 * Checks a password and returns a value indicating whether the password is a "strong"
15 * password. The criteria for a strong password are:
16 *
17 * <ul>
18 * <li>Minimum 8 characters</li>
19 * <li>Maxmium 32 characters</li>
20 * <li>Contains at least one lowercase letter</li>
21 * <li>Contains at least one uppercase letter</li>
22 * <li>Contains at least one number or symbol character</li>
23 * </ul>
24 *
25 * @param password The password to check
26 *
27 * @return A value indicating whether the password is a strong password (<code>true</code>)
28 * or not (<code>false</code>).
29 */
30 public function validateStrongPassword(password:String):Boolean
31 {
32 if (password == null || password.length <= 0)
33 {
34 return false;
35 }
36
37 return STRONG_PASSWORD_PATTERN.test(password);
38 }
39]]></script>
40
41<script type="text/javascript">
42queue(function()
43{
44 var $sh;
45
46 module('010_highlight');
47
48 test('one highlighted line', function()
49 {
50 $sh = $('#sh_010_highlight_a');
51
52 ok_sh($sh);
53 ok_toolbar($sh);
54 ok_code($sh);
55 ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted');
56 });
57
58 test('multiple highlighted lines', function()
59 {
60 $sh = $('#sh_010_highlight_b');
61
62 ok_sh($sh);
63 ok_toolbar($sh);
64 ok_code($sh);
65 ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted');
66 ok($sh.find('.gutter .number4').is('.highlighted'), 'Line 4 is highlighted');
67 ok($sh.find('.gutter .number12').is('.highlighted'), 'Line 12 is highlighted');
68 });
69});
70</script>
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">
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>
diff --git a/Blocks/syntax/tests/cases/012_server_side.html b/Blocks/syntax/tests/cases/012_server_side.html
deleted file mode 100644
index 1bb4217..0000000
--- a/Blocks/syntax/tests/cases/012_server_side.html
+++ /dev/null
@@ -1,35 +0,0 @@
1<script id="sh_012_server_side_input" type="text/plain">
2function helloWorld()
3{
4 // this is great!
5 for(var i = 0; i <= 1; i++)
6 alert("yay");
7}
8</script>
9
10<div id="sh_012_server_side_output">
11</div>
12
13<script type="text/javascript">
14queue(function()
15{
16 var $sh;
17
18 module('012_server_side');
19
20 test('generate markup', function()
21 {
22 var brush = new SyntaxHighlighter.brushes.JScript(),
23 code = $('#sh_012_server_side_input').html()
24 ;
25
26 brush.init({ toolbar: false });
27 $sh = $('#sh_012_server_side_output');
28 $sh.html(brush.getHtml(code));
29
30 ok_sh($sh);
31 ok_gutter($sh);
32 ok_code($sh);
33 });
34});
35</script> \ No newline at end of file
diff --git a/Blocks/syntax/tests/cases/013_html_script.html b/Blocks/syntax/tests/cases/013_html_script.html
deleted file mode 100644
index c0a1201..0000000
--- a/Blocks/syntax/tests/cases/013_html_script.html
+++ /dev/null
@@ -1,34 +0,0 @@
1<pre id="sh_013_html_script" class="brush: groovy; html-script: true">
2&lt;hello>
3 &lt;%
4 package free.cafekiwi.gotapi;
5 %>
6&lt;/hello>
7
8<!--
9 Comments here
10-->
11&lt;%= print(); %>
12</pre>
13
14<script type="text/javascript">
15queue(function()
16{
17 var $sh;
18
19 module('013_html_script');
20
21 test('check markup', function()
22 {
23 $sh = $('#sh_013_html_script');
24
25 ok_sh($sh);
26 ok_gutter($sh);
27 ok_code($sh);
28
29 ok($sh.find('.code .number1 > .htmlscript').length > 0, 'Has .htmlscript on line 1');
30 ok($sh.find('.code .number3 > .groovy').length > 0, 'Has .groovy on line 3');
31 ok($sh.find('.code .number10 > .groovy').length > 0, 'Has .groovy on line 10');
32 });
33});
34</script> \ No newline at end of file
diff --git a/Blocks/syntax/tests/cases/014_legacy.html b/Blocks/syntax/tests/cases/014_legacy.html
deleted file mode 100644
index eb4343e..0000000
--- a/Blocks/syntax/tests/cases/014_legacy.html
+++ /dev/null
@@ -1,70 +0,0 @@
1<pre id="sh_014_legacy_a" name="code" class="plain">basic check</pre>
2<pre id="sh_014_legacy_b" name="code" class="plain:nocontrols">no toolbar</pre>
3<pre id="sh_014_legacy_c" name="code" class="plain:nogutter">no gutter</pre>
4<pre id="sh_014_legacy_d" name="code" class="plain:collapse">collapsed</pre>
5<pre id="sh_014_legacy_e" name="code" class="plain:firstline[10]">first line</pre>
6
7<script type="text/javascript">
8queue(function()
9{
10 var $sh;
11
12 dp.SyntaxHighlighter.HighlightAll('code');
13
14 module('014_legacy');
15
16 test('basic check', function()
17 {
18 $sh = $('#sh_014_legacy_a');
19
20 ok_sh($sh);
21 ok_toolbar($sh);
22 ok_code($sh);
23 });
24
25 test('no toolbar', function()
26 {
27 $sh = $('#sh_014_legacy_b');
28
29 ok_sh($sh);
30 ok_code($sh);
31 ok($sh.find('> .syntaxhighlighter > .toolbar').length == 0, 'Toolbar not present');
32 });
33
34 test('no gutter', function()
35 {
36 $sh = $('#sh_014_legacy_c');
37
38 ok_sh($sh);
39 ok_toolbar($sh);
40 ok_code($sh);
41
42 ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present');
43 ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present');
44 });
45
46 test('collapsed check', function()
47 {
48 $sh = $('#sh_014_legacy_d');
49
50 ok_sh($sh);
51 ok_toolbar($sh);
52 ok_collapsed($sh);
53
54 var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource');
55 ok($title.length == 1, 'Expand present');
56 equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text');
57 });
58
59 test('first line check', function()
60 {
61 $sh = $('#sh_014_legacy_e');
62
63 ok_sh($sh);
64 ok_toolbar($sh);
65 ok_gutter($sh);
66 ok_code($sh);
67 equals($sh.find('.gutter .index0').text(), '10', 'First line');
68 });
69});
70</script>
Powered by cgit v1.2.3 (git 2.41.0)