Commit 6ad76c14 authored by JC Brand's avatar JC Brand

Fix test failure on travis

parent dd7bb28d
...@@ -197,7 +197,7 @@ eslint: node_modules ...@@ -197,7 +197,7 @@ eslint: node_modules
$(ESLINT) spec/ $(ESLINT) spec/
.PHONY: check .PHONY: check
check: eslint dev check: dev eslint
$(KARMA) start karma.conf.js $(ARGS) $(KARMA) start karma.conf.js $(ARGS)
.PHONY: test .PHONY: test
......
...@@ -4986,11 +4986,11 @@ describe("Groupchats", function () { ...@@ -4986,11 +4986,11 @@ describe("Groupchats", function () {
}); });
_converse.connection._dataRecv(mock.createRequest(presence)); _converse.connection._dataRecv(mock.createRequest(presence));
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() ===
"some1, newguy and nomorenicks have entered the groupchat"); "some1, newguy and nomorenicks have entered the groupchat", 1000);
// Manually clear so that we can more easily test // Manually clear so that we can more easily test
view.model.notifications.set('entered', []); view.model.notifications.set('entered', []);
await u.waitUntil(() => !view.el.querySelector('.chat-content__notifications').textContent); await u.waitUntil(() => !view.el.querySelector('.chat-content__notifications').textContent, 1000);
// See XEP-0085 https://xmpp.org/extensions/xep-0085.html#definitions // See XEP-0085 https://xmpp.org/extensions/xep-0085.html#definitions
...@@ -5012,10 +5012,9 @@ describe("Groupchats", function () { ...@@ -5012,10 +5012,9 @@ describe("Groupchats", function () {
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree(); }).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
_converse.connection._dataRecv(mock.createRequest(msg)); _converse.connection._dataRecv(mock.createRequest(msg));
csntext = await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent); csntext = await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent, 1000);
expect(csntext.trim()).toEqual('newguy is typing'); expect(csntext.trim()).toEqual('newguy is typing');
expect(remove_notifications_timeouts.length).toBe(1); expect(remove_notifications_timeouts.length).toBe(1);
expect(view.el.querySelector('.chat-content__notifications').textContent.trim()).toEqual('newguy is typing'); expect(view.el.querySelector('.chat-content__notifications').textContent.trim()).toEqual('newguy is typing');
// <composing> state for a different occupant // <composing> state for a different occupant
...@@ -5026,7 +5025,7 @@ describe("Groupchats", function () { ...@@ -5026,7 +5025,7 @@ describe("Groupchats", function () {
type: 'groupchat' type: 'groupchat'
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree(); }).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
await view.model.handleMessageStanza(msg); await view.model.handleMessageStanza(msg);
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy and nomorenicks are typing'); await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy and nomorenicks are typing', 1000);
// <composing> state for a different occupant // <composing> state for a different occupant
msg = $msg({ msg = $msg({
...@@ -5036,7 +5035,7 @@ describe("Groupchats", function () { ...@@ -5036,7 +5035,7 @@ describe("Groupchats", function () {
type: 'groupchat' type: 'groupchat'
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree(); }).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
await view.model.handleMessageStanza(msg); await view.model.handleMessageStanza(msg);
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy, nomorenicks and majortom are typing'); await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy, nomorenicks and majortom are typing', 1000);
// <composing> state for a different occupant // <composing> state for a different occupant
msg = $msg({ msg = $msg({
...@@ -5046,7 +5045,7 @@ describe("Groupchats", function () { ...@@ -5046,7 +5045,7 @@ describe("Groupchats", function () {
type: 'groupchat' type: 'groupchat'
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree(); }).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
await view.model.handleMessageStanza(msg); await view.model.handleMessageStanza(msg);
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy, nomorenicks and others are typing'); await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'newguy, nomorenicks and others are typing', 1000);
msg = $msg({ msg = $msg({
from: `${muc_jid}/some1`, from: `${muc_jid}/some1`,
...@@ -5055,15 +5054,15 @@ describe("Groupchats", function () { ...@@ -5055,15 +5054,15 @@ describe("Groupchats", function () {
type: 'groupchat' type: 'groupchat'
}).c('body').t('hello world').tree(); }).c('body').t('hello world').tree();
await view.model.handleMessageStanza(msg); await view.model.handleMessageStanza(msg);
await new Promise(resolve => view.model.messages.once('rendered', resolve), 1000);
await u.waitUntil(() => view.el.querySelectorAll('.message').length === 2); await u.waitUntil(() => view.el.querySelectorAll('.chat-msg').length === 1);
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(view.el.querySelector('.chat-msg .chat-msg__text').textContent.trim()).toBe('hello world'); expect(view.el.querySelector('.chat-msg .chat-msg__text').textContent.trim()).toBe('hello world');
// Test that the composing notifications get removed via timeout. // Test that the composing notifications get removed via timeout.
remove_notifications_timeouts[0](); if (remove_notifications_timeouts.length) {
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'nomorenicks, majortom and groundcontrol are typing'); remove_notifications_timeouts[0]();
}
await u.waitUntil(() => view.el.querySelector('.chat-content__notifications').textContent.trim() === 'nomorenicks, majortom and groundcontrol are typing', 1000);
done(); done();
})); }));
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment