Commit 2ff18c2c authored by JC Brand's avatar JC Brand

Fix emoji test (now that bootstrap dropdown is used)

parent 2045741f
...@@ -441,6 +441,8 @@ ...@@ -441,6 +441,8 @@
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
toolbar.querySelector('li.toggle-smiley').click(); toolbar.querySelector('li.toggle-smiley').click();
var timeout = false;
test_utils.waitUntil(function () { test_utils.waitUntil(function () {
return utils.isVisible(view.el.querySelector('.toggle-smiley .emoji-picker-container')); return utils.isVisible(view.el.querySelector('.toggle-smiley .emoji-picker-container'));
}, 150).then(function () { }, 150).then(function () {
...@@ -448,10 +450,22 @@ ...@@ -448,10 +450,22 @@
var items = picker.querySelectorAll('.emoji-picker li'); var items = picker.querySelectorAll('.emoji-picker li');
items[0].click() items[0].click()
expect(view.insertEmoji).toHaveBeenCalled(); expect(view.insertEmoji).toHaveBeenCalled();
setTimeout(function () { timeout = true; }, 100);
return test_utils.waitUntil(function () {
return timeout;
}, 300);
}).then(function () {
timeout = false;
toolbar.querySelector('li.toggle-smiley').click(); // Close the panel again toolbar.querySelector('li.toggle-smiley').click(); // Close the panel again
return test_utils.waitUntil(function () { return test_utils.waitUntil(function () {
return !view.el.querySelector('.toggle-smiley .toolbar-menu').offsetHeight; return !view.el.querySelector('.toggle-smiley .toolbar-menu').offsetHeight;
}, 900); }, 300);
}).then(function () {
setTimeout(function () { timeout = true; }, 100);
return test_utils.waitUntil(function () {
return timeout;
}, 300);
}).then(function () { }).then(function () {
toolbar.querySelector('li.toggle-smiley').click(); toolbar.querySelector('li.toggle-smiley').click();
expect(view.toggleEmojiMenu).toHaveBeenCalled(); expect(view.toggleEmojiMenu).toHaveBeenCalled();
...@@ -485,12 +499,12 @@ ...@@ -485,12 +499,12 @@
test_utils.openChatBoxFor(_converse, contact_jid); test_utils.openChatBoxFor(_converse, contact_jid);
var view = _converse.chatboxviews.get(contact_jid); var view = _converse.chatboxviews.get(contact_jid);
var $toolbar = $(view.el).find('ul.chat-toolbar'); var $toolbar = $(view.el).find('ul.chat-toolbar');
expect($toolbar.children('li.toggle-otr').length).toBe(1); expect($toolbar.children('.toggle-otr').length).toBe(1);
// Register spies // Register spies
spyOn(view, 'toggleOTRMenu').and.callThrough(); spyOn(view, 'toggleOTRMenu').and.callThrough();
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
$toolbar[0].querySelector('li.toggle-otr').click(); $toolbar[0].querySelector('.toggle-otr').click();
expect(view.toggleOTRMenu).toHaveBeenCalled(); expect(view.toggleOTRMenu).toHaveBeenCalled();
done(); done();
}); });
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
_.extend(_converse, Backbone.Events); _.extend(_converse, Backbone.Events);
// Core plugins are whitelisted automatically
_converse.core_plugins = [ _converse.core_plugins = [
'converse-bookmarks', 'converse-bookmarks',
'converse-chatboxes', 'converse-chatboxes',
......
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