Commit 9ee0b681 authored by JC Brand's avatar JC Brand

Fix failing test

parent 824b2c81
...@@ -1498,8 +1498,7 @@ ...@@ -1498,8 +1498,7 @@
affiliation: mock.chatroom_roles[name].affiliation, affiliation: mock.chatroom_roles[name].affiliation,
jid: name.replace(/ /g,'.').toLowerCase() + '@montague.lit', jid: name.replace(/ /g,'.').toLowerCase() + '@montague.lit',
role: role role: role
}).up() });
.c('status').attrs({code:'110'}).nodeTree;
_converse.connection._dataRecv(test_utils.createRequest(presence)); _converse.connection._dataRecv(test_utils.createRequest(presence));
expect(occupants.querySelectorAll('li').length).toBe(2+i); expect(occupants.querySelectorAll('li').length).toBe(2+i);
model = view.model.occupants.where({'nick': name})[0]; model = view.model.occupants.where({'nick': name})[0];
...@@ -2680,21 +2679,21 @@ ...@@ -2680,21 +2679,21 @@
const view = _converse.chatboxviews.get('lounge@montague.lit'), const view = _converse.chatboxviews.get('lounge@montague.lit'),
trimmed_chatboxes = _converse.minimized_chats; trimmed_chatboxes = _converse.minimized_chats;
spyOn(view, 'minimize').and.callThrough(); spyOn(view, 'onMinimized').and.callThrough();
spyOn(view, 'maximize').and.callThrough(); spyOn(view, 'onMaximized').and.callThrough();
spyOn(_converse.api, "trigger"); spyOn(_converse.api, "trigger");
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
view.el.querySelector('.toggle-chatbox-button').click(); view.el.querySelector('.toggle-chatbox-button').click();
expect(view.minimize).toHaveBeenCalled(); expect(view.onMinimized).toHaveBeenCalled();
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxMinimized', jasmine.any(Object)); expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxMinimized', jasmine.any(Object));
expect(u.isVisible(view.el)).toBeFalsy(); expect(u.isVisible(view.el)).toBeFalsy();
expect(view.model.get('minimized')).toBeTruthy(); expect(view.model.get('minimized')).toBeTruthy();
expect(view.minimize).toHaveBeenCalled(); expect(view.onMinimized).toHaveBeenCalled();
await test_utils.waitUntil(() => trimmed_chatboxes.get(view.model.get('id'))); await test_utils.waitUntil(() => trimmed_chatboxes.get(view.model.get('id')));
const trimmedview = trimmed_chatboxes.get(view.model.get('id')); const trimmedview = trimmed_chatboxes.get(view.model.get('id'));
trimmedview.el.querySelector("a.restore-chat").click(); trimmedview.el.querySelector("a.restore-chat").click();
expect(view.maximize).toHaveBeenCalled(); expect(view.onMaximized).toHaveBeenCalled();
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxMaximized', jasmine.any(Object)); expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxMaximized', jasmine.any(Object));
expect(view.model.get('minimized')).toBeFalsy(); expect(view.model.get('minimized')).toBeFalsy();
expect(_converse.api.trigger.calls.count(), 3); expect(_converse.api.trigger.calls.count(), 3);
......
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