Minor idiomatic changes
This commit is contained in:
parent
b6f4f05b9e
commit
33cd23c529
@ -1491,7 +1491,7 @@
|
|||||||
var chatbox = _converse.chatboxes.get(sender_jid);
|
var chatbox = _converse.chatboxes.get(sender_jid);
|
||||||
var chatboxview = _converse.chatboxviews.get(sender_jid);
|
var chatboxview = _converse.chatboxviews.get(sender_jid);
|
||||||
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator';
|
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator';
|
||||||
var selectMsgsIndicator = function () { return $($(_converse.rosterview.el).find(msgsIndicatorSelector)); };
|
var selectMsgsIndicator = () => $(_converse.rosterview.el).find(msgsIndicatorSelector);
|
||||||
var msgFactory = function () {
|
var msgFactory = function () {
|
||||||
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
||||||
};
|
};
|
||||||
@ -1527,7 +1527,7 @@
|
|||||||
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
||||||
};
|
};
|
||||||
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator',
|
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator',
|
||||||
selectMsgsIndicator = function () { return $($(_converse.rosterview.el).find(msgsIndicatorSelector)); };
|
selectMsgsIndicator = () => $(_converse.rosterview.el).find(msgsIndicatorSelector);
|
||||||
|
|
||||||
chatbox.save('scrolled', true);
|
chatbox.save('scrolled', true);
|
||||||
|
|
||||||
@ -1559,7 +1559,7 @@
|
|||||||
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
return test_utils.createChatMessage(_converse, sender_jid, 'This message will be received as unread, but eventually will be read');
|
||||||
};
|
};
|
||||||
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator',
|
var msgsIndicatorSelector = 'a.open-chat:contains("' + chatbox.get('fullname') + '") .msgs-indicator',
|
||||||
selectMsgsIndicator = function () { return $($(_converse.rosterview.el).find(msgsIndicatorSelector)); };
|
selectMsgsIndicator = () => $(_converse.rosterview.el).find(msgsIndicatorSelector);
|
||||||
|
|
||||||
chatbox.save('scrolled', true);
|
chatbox.save('scrolled', true);
|
||||||
|
|
||||||
@ -1591,7 +1591,7 @@
|
|||||||
};
|
};
|
||||||
const selectUnreadMsgCount = function () {
|
const selectUnreadMsgCount = function () {
|
||||||
const minimizedChatBoxView = _converse.minimized_chats.get(sender_jid);
|
const minimizedChatBoxView = _converse.minimized_chats.get(sender_jid);
|
||||||
return $(minimizedChatBoxView.el).find('.message-count');
|
return minimizedChatBoxView.el.querySelector('.message-count');
|
||||||
};
|
};
|
||||||
|
|
||||||
const chatbox = _converse.chatboxes.get(sender_jid);
|
const chatbox = _converse.chatboxes.get(sender_jid);
|
||||||
@ -1601,9 +1601,9 @@
|
|||||||
const chatboxview = _converse.chatboxviews.get(sender_jid);
|
const chatboxview = _converse.chatboxviews.get(sender_jid);
|
||||||
chatboxview.minimize();
|
chatboxview.minimize();
|
||||||
|
|
||||||
const $unreadMsgCount = selectUnreadMsgCount();
|
const unread_count = selectUnreadMsgCount();
|
||||||
expect(u.isVisible($unreadMsgCount[0])).toBeTruthy();
|
expect(u.isVisible(unread_count)).toBeTruthy();
|
||||||
expect($unreadMsgCount.html()).toBe('1');
|
expect(unread_count.innerHTML).toBe('1');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
@ -1625,7 +1625,7 @@
|
|||||||
};
|
};
|
||||||
const selectUnreadMsgCount = function () {
|
const selectUnreadMsgCount = function () {
|
||||||
const minimizedChatBoxView = _converse.minimized_chats.get(sender_jid);
|
const minimizedChatBoxView = _converse.minimized_chats.get(sender_jid);
|
||||||
return $(minimizedChatBoxView.el).find('.message-count');
|
return minimizedChatBoxView.el.querySelector('.message-count');
|
||||||
};
|
};
|
||||||
|
|
||||||
const chatboxview = _converse.chatboxviews.get(sender_jid);
|
const chatboxview = _converse.chatboxviews.get(sender_jid);
|
||||||
@ -1633,9 +1633,9 @@
|
|||||||
|
|
||||||
_converse.chatboxes.onMessage(msgFactory());
|
_converse.chatboxes.onMessage(msgFactory());
|
||||||
|
|
||||||
const $unreadMsgCount = selectUnreadMsgCount();
|
const unread_count = selectUnreadMsgCount();
|
||||||
expect(u.isVisible($unreadMsgCount[0])).toBeTruthy();
|
expect(u.isVisible(unread_count)).toBeTruthy();
|
||||||
expect($unreadMsgCount.html()).toBe('1');
|
expect(unread_count.innerHTML).toBe('1');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -60,49 +60,49 @@
|
|||||||
null, ['rosterGroupsFetched'], {},
|
null, ['rosterGroupsFetched'], {},
|
||||||
function (done, _converse) {
|
function (done, _converse) {
|
||||||
|
|
||||||
|
let jid, room, chatroomview;
|
||||||
|
|
||||||
test_utils.createContacts(_converse, 'current');
|
test_utils.createContacts(_converse, 'current');
|
||||||
test_utils.waitUntil(function () {
|
test_utils.waitUntil(() => _converse.rosterview.el.querySelectorAll('.roster-group .group-toggle').length, 300)
|
||||||
return $(_converse.rosterview.el).find('.roster-group .group-toggle').length;
|
.then(() => test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy'))
|
||||||
}, 300).then(function () {
|
.then(() => {
|
||||||
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy').then(function () {
|
jid = 'lounge@localhost';
|
||||||
var jid = 'lounge@localhost';
|
room = _converse.api.rooms.get(jid);
|
||||||
var room = _converse.api.rooms.get(jid);
|
expect(room instanceof Object).toBeTruthy();
|
||||||
expect(room instanceof Object).toBeTruthy();
|
|
||||||
|
|
||||||
var chatroomview = _converse.chatboxviews.get(jid);
|
chatroomview = _converse.chatboxviews.get(jid);
|
||||||
expect(chatroomview.is_chatroom).toBeTruthy();
|
expect(chatroomview.is_chatroom).toBeTruthy();
|
||||||
|
|
||||||
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
||||||
chatroomview.close();
|
chatroomview.close();
|
||||||
|
|
||||||
// Test with mixed case
|
// Test with mixed case
|
||||||
test_utils.openAndEnterChatRoom(_converse, 'Leisure', 'localhost', 'dummy').then(function () {
|
return test_utils.openAndEnterChatRoom(_converse, 'Leisure', 'localhost', 'dummy');
|
||||||
jid = 'Leisure@localhost';
|
}).then(() => {
|
||||||
room = _converse.api.rooms.get(jid);
|
jid = 'Leisure@localhost';
|
||||||
expect(room instanceof Object).toBeTruthy();
|
room = _converse.api.rooms.get(jid);
|
||||||
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
expect(room instanceof Object).toBeTruthy();
|
||||||
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
||||||
|
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
||||||
|
|
||||||
jid = 'leisure@localhost';
|
jid = 'leisure@localhost';
|
||||||
room = _converse.api.rooms.get(jid);
|
room = _converse.api.rooms.get(jid);
|
||||||
expect(room instanceof Object).toBeTruthy();
|
expect(room instanceof Object).toBeTruthy();
|
||||||
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
||||||
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
||||||
|
|
||||||
jid = 'leiSure@localhost';
|
jid = 'leiSure@localhost';
|
||||||
room = _converse.api.rooms.get(jid);
|
room = _converse.api.rooms.get(jid);
|
||||||
expect(room instanceof Object).toBeTruthy();
|
expect(room instanceof Object).toBeTruthy();
|
||||||
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
|
||||||
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
expect(u.isVisible(chatroomview.el)).toBeTruthy();
|
||||||
chatroomview.close();
|
chatroomview.close();
|
||||||
|
|
||||||
// Non-existing room
|
// Non-existing room
|
||||||
jid = 'lounge2@localhost';
|
jid = 'lounge2@localhost';
|
||||||
room = _converse.api.rooms.get(jid);
|
room = _converse.api.rooms.get(jid);
|
||||||
expect(typeof room === 'undefined').toBeTruthy();
|
expect(typeof room === 'undefined').toBeTruthy();
|
||||||
done();
|
done();
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -2680,7 +2680,8 @@
|
|||||||
null, ['rosterGroupsFetched'], {},
|
null, ['rosterGroupsFetched'], {},
|
||||||
function (done, _converse) {
|
function (done, _converse) {
|
||||||
|
|
||||||
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy').then(function () {
|
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy')
|
||||||
|
.then(() => {
|
||||||
var sent_IQ, IQ_id;
|
var sent_IQ, IQ_id;
|
||||||
var sendIQ = _converse.connection.sendIQ;
|
var sendIQ = _converse.connection.sendIQ;
|
||||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||||
|
Loading…
Reference in New Issue
Block a user