aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Back/Blocks/syntax/tests/syntaxhighlighter_tests.html')
-rw-r--r--Back/Blocks/syntax/tests/syntaxhighlighter_tests.html249
1 files changed, 249 insertions, 0 deletions
diff --git a/Back/Blocks/syntax/tests/syntaxhighlighter_tests.html b/Back/Blocks/syntax/tests/syntaxhighlighter_tests.html
new file mode 100644
index 0000000..58e963f
--- /dev/null
+++ b/Back/Blocks/syntax/tests/syntaxhighlighter_tests.html
@@ -0,0 +1,249 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <title>SyntaxHighlighter Highlight Tests</title>
6
7 <!-- jQuery & QUnit -->
8 <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
9 <script type="text/javascript" src="js/qunit.js"></script>
10 <link type="text/css" rel="stylesheet" href="js/qunit.css"/>
11
12 <!-- SyntaxHighlighter -->
13 <script type="text/javascript" src="/sh/scripts/XRegExp.js"></script> <!-- XRegExp is bundled with the final shCore.js during build -->
14 <script type="text/javascript" src="/sh/scripts/shCore.js"></script>
15 <script type="text/javascript" src="/sh/scripts/shLegacy.js"></script>
16 <script type="text/javascript" src="/sh/scripts/shBrushAppleScript.js"></script>
17 <script type="text/javascript" src="/sh/scripts/shBrushAS3.js"></script>
18 <script type="text/javascript" src="/sh/scripts/shBrushBash.js"></script>
19 <script type="text/javascript" src="/sh/scripts/shBrushColdFusion.js"></script>
20 <script type="text/javascript" src="/sh/scripts/shBrushCpp.js"></script>
21 <script type="text/javascript" src="/sh/scripts/shBrushCSharp.js"></script>
22 <script type="text/javascript" src="/sh/scripts/shBrushCss.js"></script>
23 <script type="text/javascript" src="/sh/scripts/shBrushDelphi.js"></script>
24 <script type="text/javascript" src="/sh/scripts/shBrushDiff.js"></script>
25 <script type="text/javascript" src="/sh/scripts/shBrushErlang.js"></script>
26 <script type="text/javascript" src="/sh/scripts/shBrushGroovy.js"></script>
27 <script type="text/javascript" src="/sh/scripts/shBrushJava.js"></script>
28 <script type="text/javascript" src="/sh/scripts/shBrushJavaFx.js"></script>
29 <script type="text/javascript" src="/sh/scripts/shBrushJScript.js"></script>
30 <script type="text/javascript" src="/sh/scripts/shBrushPerl.js"></script>
31 <script type="text/javascript" src="/sh/scripts/shBrushPhp.js"></script>
32 <script type="text/javascript" src="/sh/scripts/shBrushPlain.js"></script>
33 <script type="text/javascript" src="/sh/scripts/shBrushPowerShell.js"></script>
34 <script type="text/javascript" src="/sh/scripts/shBrushPython.js"></script>
35 <script type="text/javascript" src="/sh/scripts/shBrushRuby.js"></script>
36 <script type="text/javascript" src="/sh/scripts/shBrushSass.js"></script>
37 <script type="text/javascript" src="/sh/scripts/shBrushScala.js"></script>
38 <script type="text/javascript" src="/sh/scripts/shBrushSql.js"></script>
39 <script type="text/javascript" src="/sh/scripts/shBrushVb.js"></script>
40 <script type="text/javascript" src="/sh/scripts/shBrushXml.js"></script>
41
42 <link type="text/css" rel="stylesheet" href="/sh/styles/shCoreDefault.css"/>
43</head>
44
45<body>
46
47<h1 id="qunit-header">SyntaxHighlighter Highlight Lines Test</h1>
48<h2 id="qunit-banner"></h2>
49<div id="qunit-testrunner-toolbar"></div>
50<h2 id="qunit-userAgent"></h2>
51<ol id="qunit-tests"></ol>
52
53<button id="interaction">Run interaction tests</button>
54
55<div id="output">
56</div>
57
58<style>
59body {
60 background: white;
61}
62
63#interaction {
64 margin-top: 1em;
65 padding: 1em;
66 font-size: 1.5em;
67}
68
69.test-wrap {
70 width: 45%;
71 height: 400px;
72 overflow: auto;
73 float: left;
74 margin: 1em 1em 0 0;
75 border: 5px solid silver;
76 background: gray;
77 font-family: Helvetica;
78}
79
80.test-wrap h3 {
81 margin: 1em 0 0 1em;
82 color: white;
83 font-size: 1em;
84 font-weight: normal;
85}
86</style>
87
88<script type="text/javascript">
89var testQueue = [],
90 renderTests = [
91 '001_basic',
92 '002_brushes',
93 '003_script_tag',
94 '004_url_parsing',
95 '005_no_gutter',
96 '006_pad_line_numbers',
97 '007_collapse',
98 '008_first_line',
99 '009_class_name',
100 '010_highlight',
101 '011_smart_tabs',
102 '012_server_side',
103 '013_html_script',
104 '014_legacy'
105 ],
106 interactionTests = [
107 '007_collapse_interaction'
108 ]
109 ;
110
111function queue(func)
112{
113 testQueue.push(func);
114};
115
116function ok_sh($sh)
117{
118 ok($sh.length > 0, 'Element present');
119 ok($sh.is('div'), 'Element is DIV');
120 ok($sh.find('> div').is('.syntaxhighlighter'), 'Nested DIV is a .syntaxhighlighter');
121};
122
123function ok_toolbar($sh)
124{
125 var $target = $sh.find('> .syntaxhighlighter > .toolbar');
126 ok($target.length > 0, 'Toolbar present');
127 ok($target.is(':visible'), 'Toolbar visible');
128};
129
130function ok_caption($sh, value)
131{
132 var $target = $sh.find('> .syntaxhighlighter > table > caption');
133 ok($target.length > 0, 'Caption present');
134 ok($target.is(':visible'), 'Caption visible');
135
136 if (value != null)
137 equals($target.text(), value, 'Caption text');
138};
139
140function ok_gutter($sh)
141{
142 var $target = $sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter');
143 ok($target.length > 0, 'Gutter present');
144 ok($target.is(':visible'), 'Gutter visible');
145};
146
147function ok_code($sh)
148{
149 var $target = $sh.find('> .syntaxhighlighter > table > tbody > tr > .code');
150 ok($target.length > 0, 'Code present');
151 ok($target.is(':visible'), 'Code visible');
152};
153
154function ok_collapsed($sh)
155{
156 ok($sh.find('> .syntaxhighlighter.collapsed').length == 1, '.collapsed present');
157};
158
159function loadTests(tests, addHtml)
160{
161 var html = '';
162
163 $.each(tests, function(index)
164 {
165 var name = this;
166
167 if (addHtml != false)
168 {
169 html += '<div class="test-wrap">\n'
170 html += '<h3>' + name + '</h3>\n';
171 }
172
173 $.ajax({
174 url: 'cases/' + name + '.html',
175 type: 'GET',
176 dataType: 'text',
177 async: false,
178 success: function(data)
179 {
180 html += data;
181 },
182 error: function()
183 {
184 html += '<p>Not found...</p>';
185 }
186 });
187
188 if (addHtml != false)
189 {
190 html += '</div>\n';
191
192 if (index % 2 != 0)
193 html += '<div style="clear:both"></div>\n';
194 }
195 });
196
197 //
198 // Looks like .html() is producing different results when it comes to
199 // content that has <script /> which type is NOT "text/javascript".
200 // $('#output').html(html);
201 //
202 $('#output')[0].innerHTML += html;
203
204 //
205 // However, if HTML assigned to to .innerHTML container <script/> tags,
206 // they are not executed, so we have to manually walk all of them and
207 // eval() the content.
208 //
209 $('#output script[type="text/javascript"][class!="executed"]').each(function()
210 {
211 eval($(this).text() || $(this).html());
212 $(this).addClass('executed')
213 });
214};
215
216function runTestQueue()
217{
218
219 $.each(testQueue, function()
220 {
221 this.apply(null);
222 });
223
224 testQueue = [];
225};
226
227$(document).ready(function()
228{
229 loadTests(renderTests);
230 SyntaxHighlighter.highlight();
231 runTestQueue();
232
233 $('#interaction').click(function()
234 {
235 loadTests(interactionTests, false /* addHtml */);
236 runTestQueue();
237 });
238});
239</script>
240
241
242<!-- jinwei.me Baidu tongji analytics -->
243<script type="text/javascript">
244var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
245document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F91918ac6d6854623883a2b546ebc00ac' type='text/javascript'%3E%3C/script%3E"));
246</script>
247
248</body>
249</html>
Powered by cgit v1.2.3 (git 2.41.0)