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