mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
added tests for getFormatterDefault(), fixing bug in compact design
This commit is contained in:
parent
a30b31b315
commit
fcfb02c2b7
34
js/test.js
34
js/test.js
@ -595,6 +595,40 @@ describe('Model', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getFormatDefault', function () {
|
||||||
|
before(function () {
|
||||||
|
$.PrivateBin.Model.reset();
|
||||||
|
cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
jsc.property(
|
||||||
|
'returns the contents of the element with id "pasteFormatter"',
|
||||||
|
'array asciinestring',
|
||||||
|
'string',
|
||||||
|
'small nat',
|
||||||
|
function (keys, value, key) {
|
||||||
|
keys = keys.map($.PrivateBin.Helper.htmlEntities);
|
||||||
|
value = $.PrivateBin.Helper.htmlEntities(value);
|
||||||
|
var content = keys.length > key ? keys[key] : (keys.length > 0 ? keys[0] : 'null'),
|
||||||
|
contents = '<select id="pasteFormatter" name="pasteFormatter">';
|
||||||
|
keys.forEach(function(item) {
|
||||||
|
contents += '<option value="' + item + '"';
|
||||||
|
if (item === content) {
|
||||||
|
contents += ' selected="selected"';
|
||||||
|
}
|
||||||
|
contents += '>' + value + '</option>';
|
||||||
|
});
|
||||||
|
contents += '</select>';
|
||||||
|
$('body').html(contents);
|
||||||
|
var result = $.PrivateBin.Helper.htmlEntities(
|
||||||
|
$.PrivateBin.Model.getFormatDefault()
|
||||||
|
);
|
||||||
|
$.PrivateBin.Model.reset();
|
||||||
|
return content === result;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('getPasteId', function () {
|
describe('getPasteId', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
$.PrivateBin.Model.reset();
|
$.PrivateBin.Model.reset();
|
||||||
|
@ -230,6 +230,17 @@ if ($isCpct):
|
|||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
|
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
|
||||||
|
<?php
|
||||||
|
foreach ($FORMATTER as $key => $value):
|
||||||
|
?>
|
||||||
|
<option value="<?php echo $key; ?>"<?php
|
||||||
|
if ($key == $FORMATTERDEFAULT):
|
||||||
|
?> selected="selected"<?php
|
||||||
|
endif;
|
||||||
|
?>><?php echo $value; ?></option>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
|
Loading…
Reference in New Issue
Block a user