nextcloud/plugins/textviewer/syntaxhighlighter/tests/cases/014_legacy.html

71 lines
1.7 KiB
HTML

<pre id="sh_014_legacy_a" name="code" class="plain">basic check</pre>
<pre id="sh_014_legacy_b" name="code" class="plain:nocontrols">no toolbar</pre>
<pre id="sh_014_legacy_c" name="code" class="plain:nogutter">no gutter</pre>
<pre id="sh_014_legacy_d" name="code" class="plain:collapse">collapsed</pre>
<pre id="sh_014_legacy_e" name="code" class="plain:firstline[10]">first line</pre>
<script type="text/javascript">
queue(function()
{
var $sh;
dp.SyntaxHighlighter.HighlightAll('code');
module('014_legacy');
test('basic check', function()
{
$sh = $('#sh_014_legacy_a');
ok_sh($sh);
ok_toolbar($sh);
ok_code($sh);
});
test('no toolbar', function()
{
$sh = $('#sh_014_legacy_b');
ok_sh($sh);
ok_code($sh);
ok($sh.find('> .syntaxhighlighter > .toolbar').length == 0, 'Toolbar not present');
});
test('no gutter', function()
{
$sh = $('#sh_014_legacy_c');
ok_sh($sh);
ok_toolbar($sh);
ok_code($sh);
ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present');
ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present');
});
test('collapsed check', function()
{
$sh = $('#sh_014_legacy_d');
ok_sh($sh);
ok_toolbar($sh);
ok_collapsed($sh);
var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource');
ok($title.length == 1, 'Expand present');
equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text');
});
test('first line check', function()
{
$sh = $('#sh_014_legacy_e');
ok_sh($sh);
ok_toolbar($sh);
ok_gutter($sh);
ok_code($sh);
equals($sh.find('.gutter .index0').text(), '10', 'First line');
});
});
</script>