making PasteStatus testable, adding test for paste creation notification
This commit is contained in:
parent
e51aa7c80f
commit
6c8f57f91f
|
@ -302,8 +302,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
* internationalization module
|
* internationalization module
|
||||||
*
|
*
|
||||||
* @name I18n
|
* @name I18n
|
||||||
* @param {object} window
|
|
||||||
* @param {object} document
|
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
var I18n = (function () {
|
var I18n = (function () {
|
||||||
|
@ -1264,10 +1262,9 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
* handles paste status/result
|
* handles paste status/result
|
||||||
*
|
*
|
||||||
* @name PasteStatus
|
* @name PasteStatus
|
||||||
* @param {object} window
|
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
var PasteStatus = (function (window) {
|
var PasteStatus = (function () {
|
||||||
var me = {};
|
var me = {};
|
||||||
|
|
||||||
var $pasteSuccess,
|
var $pasteSuccess,
|
||||||
|
@ -1410,7 +1407,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
})(window);
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* password prompt
|
* password prompt
|
||||||
|
|
37
js/test.js
37
js/test.js
|
@ -1163,3 +1163,40 @@ describe('Alert', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('PasteStatus', function () {
|
||||||
|
describe('createPasteNotification', function () {
|
||||||
|
this.timeout(30000);
|
||||||
|
before(function () {
|
||||||
|
cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
jsc.property(
|
||||||
|
'creates a notification after a successfull paste upload',
|
||||||
|
jsc.elements(schemas),
|
||||||
|
jsc.nearray(jsc.elements(a2zString)),
|
||||||
|
jsc.array(jsc.elements(queryString)),
|
||||||
|
'string',
|
||||||
|
jsc.elements(schemas),
|
||||||
|
jsc.nearray(jsc.elements(a2zString)),
|
||||||
|
jsc.array(jsc.elements(queryString)),
|
||||||
|
function (
|
||||||
|
schema1, address1, query1, fragment1,
|
||||||
|
schema2, address2, query2
|
||||||
|
) {
|
||||||
|
var expected1 = schema1 + '://' + address1.join('') + '/?' +
|
||||||
|
encodeURI(query1.join('') + '#' + fragment1),
|
||||||
|
expected2 = schema2 + '://' + address2.join('') + '/?' +
|
||||||
|
encodeURI(query2.join('')),
|
||||||
|
clean = jsdom();
|
||||||
|
$('body').html('<div><div id="deletelink"></div><div id="pastelink"></div></div>');
|
||||||
|
$.PrivateBin.PasteStatus.init();
|
||||||
|
$.PrivateBin.PasteStatus.createPasteNotification(expected1, expected2);
|
||||||
|
var result1 = $('#pasteurl')[0].href,
|
||||||
|
result2 = $('#deletelink a')[0].href;
|
||||||
|
clean();
|
||||||
|
return result1 == expected1 && result2 == expected2;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-FyLKI8IhQHnJ24H05KGlzJGOht+xoMUj7Io5BL02qGUzdL6bXGPiQlmTOlbxAwDo0x+AP9m1pfGpI3UbC0T0sw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-o8cPnAUDs/kjS8bCGGJk43T9OCGpS3qaJny4xvMMXzWV4jvoXB8GKWlHeRe3mb5MagYcu1rkmcyN9mP1TqE6ng==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -47,7 +47,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-FyLKI8IhQHnJ24H05KGlzJGOht+xoMUj7Io5BL02qGUzdL6bXGPiQlmTOlbxAwDo0x+AP9m1pfGpI3UbC0T0sw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-o8cPnAUDs/kjS8bCGGJk43T9OCGpS3qaJny4xvMMXzWV4jvoXB8GKWlHeRe3mb5MagYcu1rkmcyN9mP1TqE6ng==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in New Issue