'use strict'; var common = require('../common'); describe('DiscussionViewer', function () { describe('handleNotification, addComment, finishDiscussion, prepareNewDiscussion, getReplyMessage, getReplyNickname, getReplyCommentId & highlightComment', function () { this.timeout(30000); before(function () { cleanup(); }); jsc.property( 'displays & hides comments as requested', jsc.array( jsc.record({ id: jsc.nearray(common.jscAlnumString()), parentid: jsc.nearray(common.jscAlnumString()), data: jsc.string, meta: jsc.record({ nickname: jsc.string, postdate: jsc.nat, vizhash: jsc.string }) }) ), function (comments) { var clean = jsdom(), results = []; $('body').html( '

Discussion

' + '
' + '
' + '
name' + '0000-00-00
' + '
c
' + '' + '

' + '' + '

' ); $.PrivateBin.DiscussionViewer.init(); results.push( !$('#discussion').hasClass('hidden') ); $.PrivateBin.DiscussionViewer.prepareNewDiscussion(); results.push( $('#discussion').hasClass('hidden') ); comments.forEach(function (originalComment) { var comment = { id: originalComment.id.join(''), parentid: originalComment.parentid.join(''), data: originalComment.data, meta: originalComment.meta } $.PrivateBin.DiscussionViewer.addComment(comment, comment.data, comment.meta.nickname); }); results.push( $('#discussion').hasClass('hidden') ); clean(); return results.every(element => element); } ); }); });