Remove animate config settings.

Also update tests
This commit is contained in:
JC Brand 2019-05-23 21:44:00 +02:00
parent 04af3eb029
commit f0a680e492
4 changed files with 16 additions and 32 deletions

View File

@ -219,13 +219,6 @@ Support for `XEP-0077: In band registration <https://xmpp.org/extensions/xep-007
Allow XMPP account registration showing the corresponding UI register form interface.
animate
-------
* Default: ``true``
Show animations, for example when opening and closing chatboxes.
archived_messages_page_size
---------------------------

View File

@ -123,25 +123,17 @@
const filter = _converse.rosterview.el.querySelector('.roster-filter');
const names = mock.cur_names;
test_utils.openControlBox();
_converse.rosterview.update(); // XXX: Will normally called as event handler
expect(_.isNull(filter)).toBe(false);
await test_utils.waitUntil(() => !u.isVisible(filter));
for (let i=0; i<names.length; i++) {
_converse.roster.create({
ask: null,
fullname: names[i],
jid: names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
requesting: 'false',
subscription: 'both'
});
_converse.rosterview.update(); // XXX: Will normally called as event handler
}
test_utils.createContacts(_converse, 'current').openControlBox();
const view = _converse.chatboxviews.get('controlbox');
const flyout = view.el.querySelector('.box-flyout');
const panel = flyout.querySelector('.controlbox-pane');
function hasScrollBar (el) {
return el.isConnected && el.parentElement.offsetHeight < el.scrollHeight;
return el.isConnected && flyout.offsetHeight < panel.scrollHeight;
}
await test_utils.waitUntil(
() => hasScrollBar(_converse.rosterview.roster_el) ? u.isVisible(filter) : !u.isVisible(filter)
);
const el = _converse.rosterview.roster_el;
await test_utils.waitUntil(() => hasScrollBar(el) ? u.isVisible(filter) : !u.isVisible(filter), 900);
done();
}));
@ -321,25 +313,25 @@
jid = mock.cur_names[4].replace(/ /g,'.').toLowerCase() + '@localhost';
_converse.roster.get(jid).presence.set('show', 'dnd');
test_utils.openControlBox();
const button = _converse.rosterview.el.querySelector('span[data-type="state"]');
button.click();
const roster = _converse.rosterview.roster_el;
await test_utils.waitUntil(() => sizzle('li', roster).filter(u.isVisible).length === 15, 500);
await test_utils.waitUntil(() => sizzle('li', roster).filter(u.isVisible).length === 15, 900);
console.log('First await')
const filter = _converse.rosterview.el.querySelector('.state-type');
expect(sizzle('ul.roster-group-contacts', roster).filter(u.isVisible).length).toBe(5);
filter.value = "online";
u.triggerEvent(filter, 'change');
await test_utils.waitUntil(() => sizzle('li', roster).filter(u.isVisible).length === 1, 500);
await test_utils.waitUntil(() => sizzle('li', roster).filter(u.isVisible).length === 1, 900);
expect(sizzle('li', roster).filter(u.isVisible).pop().textContent.trim()).toBe('Rinse Sommer');
await test_utils.waitUntil(() => sizzle('ul.roster-group-contacts', roster).filter(u.isVisible).length === 1, 500);
await test_utils.waitUntil(() => sizzle('ul.roster-group-contacts', roster).filter(u.isVisible).length === 1, 900);
console.log('Second await')
const ul = sizzle('ul.roster-group-contacts', roster).filter(u.isVisible).pop();
expect(ul.parentElement.firstElementChild.textContent.trim()).toBe('friends & acquaintences');
filter.value = "dnd";
u.triggerEvent(filter, 'change');
await test_utils.waitUntil(() => sizzle('li', roster).filter(u.isVisible).pop().textContent.trim() === 'Annegreet Gomez', 900);
console.log('Third await')
expect(sizzle('ul.roster-group-contacts', roster).filter(u.isVisible).length).toBe(1);
done();
}));

View File

@ -867,13 +867,13 @@ converse.plugins.add('converse-rosterview', {
}
}, 100),
update: _.debounce(function () {
update () {
if (!u.isVisible(this.roster_el)) {
u.showElement(this.roster_el);
}
this.filter_view.showOrHide();
return this;
}, _converse.animate ? 100 : 0),
},
filter (query, type) {
// First we make sure the filter is restored to its

View File

@ -188,7 +188,6 @@ _converse.CONTROLBOX_TYPE = 'controlbox';
// ----------------------------
_converse.default_settings = {
allow_non_roster_messaging: false,
animate: true,
authentication: 'login', // Available values are "login", "prebind", "anonymous" and "external".
auto_away: 0, // Seconds after which user status is set to 'away'
auto_login: false, // Currently only used in connection with anonymous login