diff --git a/js/test.js b/js/test.js
index c1eec7ea..f0a4c474 100644
--- a/js/test.js
+++ b/js/test.js
@@ -629,6 +629,48 @@ describe('Model', function () {
);
});
+ describe('hasCipherData', function () {
+ before(function () {
+ $.PrivateBin.Model.reset();
+ cleanup();
+ });
+
+ jsc.property(
+ 'checks if the element with id "cipherdata" contains any data',
+ 'asciistring',
+ function (value) {
+ value = $.PrivateBin.Helper.htmlEntities(value).trim();
+ $('body').html('
' + value + '
');
+ $.PrivateBin.Model.init();
+ var result = $.PrivateBin.Model.hasCipherData();
+ $.PrivateBin.Model.reset();
+ return (value.length > 0) === result;
+ }
+ );
+ });
+
+ describe('getCipherData', function () {
+ before(function () {
+ $.PrivateBin.Model.reset();
+ cleanup();
+ });
+
+ jsc.property(
+ 'returns the contents of the element with id "cipherdata"',
+ 'asciistring',
+ function (value) {
+ value = $.PrivateBin.Helper.htmlEntities(value).trim();
+ $('body').html('' + value + '
');
+ $.PrivateBin.Model.init();
+ var result = $.PrivateBin.Helper.htmlEntities(
+ $.PrivateBin.Model.getCipherData()
+ );
+ $.PrivateBin.Model.reset();
+ return value === result;
+ }
+ );
+ });
+
describe('getPasteId', function () {
before(function () {
$.PrivateBin.Model.reset();
@@ -738,4 +780,33 @@ describe('Model', function () {
}
);
});
+
+ describe('getTemplate', function () {
+ before(function () {
+ $.PrivateBin.Model.reset();
+ cleanup();
+ });
+
+ jsc.property(
+ 'returns the contents of the element with id "[name]template"',
+ jsc.nearray(jsc.elements(alnumString)),
+ jsc.nearray(jsc.elements(a2zString)),
+ jsc.nearray(jsc.elements(alnumString)),
+ function (id, element, value) {
+ id = id.join('');
+ element = element.join('');
+ value = value.join('').trim();
+ $('body').html(
+ '<' + element + ' id="' + id +
+ 'template">' + value + '' + element + '>
'
+ );
+ $.PrivateBin.Model.init();
+ var template = '<' + element + ' id="' + id + '">' + value +
+ '' + element + '>',
+ result = $.PrivateBin.Model.getTemplate(id).wrap('').parent().html();
+ $.PrivateBin.Model.reset();
+ return template === result;
+ }
+ );
+ });
});