mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-22 22:27:39 -04:00
test: change all other tests to not use jQuery
This commit is contained in:
+17
-17
@@ -28,7 +28,7 @@ describe('DiscussionViewer', function () {
|
||||
function (comments, commentKey, fadeOut, nickname, message, alertType, alert) {
|
||||
var clean = globalThis.cleanup(),
|
||||
results = [];
|
||||
$('body').html(
|
||||
document.body.innerHTML = (
|
||||
'<div id="discussion"><h4>Discussion</h4>' +
|
||||
'<div id="commentcontainer"></div></div><div id="templates">' +
|
||||
'<article id="commenttemplate" class="comment">' +
|
||||
@@ -51,11 +51,11 @@ describe('DiscussionViewer', function () {
|
||||
PrivateBin.Model.init();
|
||||
PrivateBin.DiscussionViewer.init();
|
||||
results.push(
|
||||
!$('#discussion').hasClass('hidden')
|
||||
!document.getElementById('discussion').classList.contains('hidden')
|
||||
);
|
||||
PrivateBin.DiscussionViewer.prepareNewDiscussion();
|
||||
results.push(
|
||||
$('#discussion').hasClass('hidden')
|
||||
document.getElementById('discussion').classList.contains('hidden')
|
||||
);
|
||||
comments.forEach(function (comment) {
|
||||
comment.id = comment.idArray.join('');
|
||||
@@ -63,12 +63,12 @@ describe('DiscussionViewer', function () {
|
||||
PrivateBin.DiscussionViewer.addComment(PrivateBin.Helper.CommentFactory(comment), comment.data, comment.meta.nickname);
|
||||
});
|
||||
results.push(
|
||||
$('#discussion').hasClass('hidden')
|
||||
document.getElementById('discussion').classList.contains('hidden')
|
||||
);
|
||||
PrivateBin.DiscussionViewer.finishDiscussion();
|
||||
results.push(
|
||||
!$('#discussion').hasClass('hidden') &&
|
||||
comments.length + 1 >= $('#commentcontainer').children().length
|
||||
!document.getElementById('discussion').classList.contains('hidden') &&
|
||||
comments.length + 1 >= document.getElementById('commentcontainer').children.length
|
||||
);
|
||||
if (comments.length > 0) {
|
||||
if (commentKey >= comments.length) {
|
||||
@@ -76,19 +76,19 @@ describe('DiscussionViewer', function () {
|
||||
}
|
||||
PrivateBin.DiscussionViewer.highlightComment(comments[commentKey].id, fadeOut);
|
||||
results.push(
|
||||
$('#comment_' + comments[commentKey].id).hasClass('highlight')
|
||||
document.getElementById('comment_' + comments[commentKey].id).classList.contains('highlight')
|
||||
);
|
||||
}
|
||||
$('#commentcontainer').find('button')[0].click();
|
||||
document.getElementById('commentcontainer').querySelector('button').click();
|
||||
results.push(
|
||||
!$('#reply').hasClass('hidden')
|
||||
!document.getElementById('reply').classList.contains('hidden')
|
||||
);
|
||||
$('#reply #nickname').val(nickname);
|
||||
$('#reply #replymessage').val(message);
|
||||
document.querySelector('#reply #nickname').value = nickname;
|
||||
document.querySelector('#reply #replymessage').value = message;
|
||||
PrivateBin.DiscussionViewer.getReplyCommentId();
|
||||
results.push(
|
||||
PrivateBin.DiscussionViewer.getReplyNickname() === $('#reply #nickname').val() &&
|
||||
PrivateBin.DiscussionViewer.getReplyMessage() === $('#reply #replymessage').val()
|
||||
PrivateBin.DiscussionViewer.getReplyNickname() === document.querySelector('#reply #nickname').value &&
|
||||
PrivateBin.DiscussionViewer.getReplyMessage() === document.querySelector('#reply #replymessage').value
|
||||
);
|
||||
var notificationResult = PrivateBin.DiscussionViewer.handleNotification(alertType === 'other' ? alert : alertType);
|
||||
if (alertType === 'loading') {
|
||||
@@ -96,11 +96,11 @@ describe('DiscussionViewer', function () {
|
||||
} else {
|
||||
results.push(
|
||||
alertType === 'danger' ? (
|
||||
notificationResult.hasClass('alert-danger') &&
|
||||
!notificationResult.hasClass('alert-info')
|
||||
notificationResult.classList.contains('alert-danger') &&
|
||||
!notificationResult.classList.contains('alert-info')
|
||||
) : (
|
||||
!notificationResult.hasClass('alert-danger') &&
|
||||
notificationResult.hasClass('alert-info')
|
||||
!notificationResult.classList.contains('alert-danger') &&
|
||||
notificationResult.classList.contains('alert-info')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user