diff --git a/js/test/PasteStatus.js b/js/test/PasteStatus.js index 2c48bd38..282a4e82 100644 --- a/js/test/PasteStatus.js +++ b/js/test/PasteStatus.js @@ -22,6 +22,20 @@ describe('PasteStatus', function () { describe('createPasteNotification', function () { this.timeout(30000); + it('creates a notification after a successful document upload', function () { + const clean = jsdom(); + $('body').html(''); + PrivateBin.PasteStatus.init(); + const expected1 = 'https://example.com/long'; + const expected2 = 'https://example.com/short'; + PrivateBin.PasteStatus.createPasteNotification(expected1, expected2); + const result1 = $('#pasteurl')[0].href, + result2 = $('#deletelink')[0].href; + clean(); + assert.strictEqual(result1, expected1); + assert.strictEqual(result2, expected2); + }); + jsc.property( 'creates a notification after a successful document upload', common.jscUrl(), diff --git a/js/test/PasteViewer.js b/js/test/PasteViewer.js index 80ae6341..0bb6bf94 100644 --- a/js/test/PasteViewer.js +++ b/js/test/PasteViewer.js @@ -5,6 +5,22 @@ describe('PasteViewer', function () { describe('run, hide, getText, setText, getFormat, setFormat & isPrettyPrinted', function () { this.timeout(30000); + it('basic plaintext display works', function () { + const clean = jsdom(); + $('body').html( + '' + + '' + + '' + ); + PrivateBin.PasteViewer.init(); + PrivateBin.PasteViewer.setFormat('plaintext'); + PrivateBin.PasteViewer.setText('hello'); + PrivateBin.PasteViewer.run(); + assert.strictEqual(PrivateBin.PasteViewer.getText(), 'hello'); + assert.ok(!$('#plaintext').hasClass('hidden')); + clean(); + }); + jsc.property( 'displays text according to format', common.jscFormats(),