Commit 47936dbf authored by JC Brand's avatar JC Brand

Fix failing test for #1438

parent 8dcb327e
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
"test-utils"], factory); "test-utils"], factory);
} (this, function (jasmine, $, mock, test_utils) { } (this, function (jasmine, $, mock, test_utils) {
"use strict"; "use strict";
var Strophe = converse.env.Strophe; const Strophe = converse.env.Strophe;
var $iq = converse.env.$iq; const $iq = converse.env.$iq;
var $pres = converse.env.$pres; const $pres = converse.env.$pres;
var _ = converse.env._; const _ = converse.env._;
var u = converse.env.utils; const sizzle = converse.env.sizzle;
const u = converse.env.utils;
// See: // See:
// https://xmpp.org/rfcs/rfc3921.html // https://xmpp.org/rfcs/rfc3921.html
...@@ -280,21 +281,21 @@ ...@@ -280,21 +281,21 @@
// The contact should now be visible as an existing // The contact should now be visible as an existing
// contact (but still offline). // contact (but still offline).
await test_utils.waitUntil(function () { await test_utils.waitUntil(() => {
var $header = $('a:contains("My contacts")'); const header = sizzle('a:contains("My contacts")', _converse.rosterview.el);
var $contacts = $header.parent().find('li:visible'); return sizzle('li', header[0].parentNode).filter(l => u.isVisible(l)).length;
return $contacts.length;
}, 600); }, 600);
$header = $('a:contains("My contacts")'); const header = sizzle('a:contains("My contacts")', _converse.rosterview.el);
expect($header.length).toBe(1); expect(header.length).toBe(1);
expect($header.is(":visible")).toBeTruthy(); expect(u.isVisible(header[0])).toBeTruthy();
$contacts = $header.parent().find('li'); const contacts = header[0].parentNode.querySelectorAll('li');
expect($contacts.length).toBe(1); expect(contacts.length).toBe(1);
// Check that it has the right classes and text // Check that it has the right classes and text
expect($contacts.hasClass('to')).toBeTruthy(); expect(u.hasClass('to', contacts[0])).toBeTruthy();
expect($contacts.hasClass('both')).toBeFalsy(); expect(u.hasClass('both', contacts[0])).toBeFalsy();
expect($contacts.hasClass('current-xmpp-contact')).toBeTruthy(); expect(u.hasClass('current-xmpp-contact', contacts[0])).toBeTruthy();
expect($contacts.text().trim()).toBe('Nicky'); expect(contacts[0].textContent.trim()).toBe('Nicky');
expect(contact.presence.get('show')).toBe('offline'); expect(contact.presence.get('show')).toBe('offline');
/* <presence /* <presence
......
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