Commit 519bd54a authored by JC Brand's avatar JC Brand

Fixes #1457. Wrong tooltip shown for "unbookmark" icon

parent d3a45551
......@@ -5,6 +5,7 @@
- New config setting [locked_muc_domain](https://conversejs.org/docs/html/configuration.html#locked-muc-domain)
- #1373: Re-add support for the [muc_domain](https://conversejs.org/docs/html/configuration.html#muc-domain) setting
- #1437: List of groupchats in modal doesn't scroll
- #1457: Wrong tooltip shown for "unbookmark" icon
## 4.1.2 (2019-02-22)
......
......@@ -42,15 +42,17 @@
spyOn(view, 'renderBookmarkForm').and.callThrough();
spyOn(view, 'closeForm').and.callThrough();
await test_utils.waitUntil(() => !_.isNull(view.el.querySelector('.toggle-bookmark')));
const bookmark = view.el.querySelector('.toggle-bookmark');
bookmark.click();
let toggle = view.el.querySelector('.toggle-bookmark');
expect(toggle.title).toBe('Bookmark this groupchat');
toggle.click();
expect(view.renderBookmarkForm).toHaveBeenCalled();
view.el.querySelector('.button-cancel').click();
expect(view.closeForm).toHaveBeenCalled();
expect(u.hasClass('on-button', bookmark), false);
expect(u.hasClass('on-button', toggle), false);
expect(toggle.title).toBe('Bookmark this groupchat');
bookmark.click();
toggle.click();
expect(view.renderBookmarkForm).toHaveBeenCalled();
/* Client uploads data:
......@@ -133,8 +135,10 @@
});
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await test_utils.waitUntil(() => view.model.get('bookmarked'));
toggle = view.el.querySelector('.toggle-bookmark');
expect(view.model.get('bookmarked')).toBeTruthy();
expect(u.hasClass('on-button', bookmark), true);
expect(toggle.title).toBe('Unbookmark this groupchat');
expect(u.hasClass('on-button', toggle), true);
// We ignore this IQ stanza... (unless it's an error stanza), so
// nothing to test for here.
done();
......
......@@ -62,8 +62,10 @@ converse.plugins.add('converse-bookmarks', {
const bookmark_button = tpl_chatroom_bookmark_toggle(
_.assignIn(this.model.toJSON(), {
info_toggle_bookmark: __('Bookmark this groupchat'),
bookmarked: this.model.get('bookmarked')
'info_toggle_bookmark': this.model.get('bookmarked') ?
__('Unbookmark this groupchat') :
__('Bookmark this groupchat'),
'bookmarked': this.model.get('bookmarked')
}));
const close_button = this.el.querySelector('.close-chatbox-button');
close_button.insertAdjacentHTML('afterend', bookmark_button);
......
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