protocol.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. (function (root, factory) {
  2. define([
  3. "jasmine",
  4. "jquery",
  5. "converse-core",
  6. "mock",
  7. "test-utils"], factory);
  8. } (this, function (jasmine, $, converse, mock, test_utils) {
  9. "use strict";
  10. var Strophe = converse.env.Strophe;
  11. var $iq = converse.env.$iq;
  12. var $pres = converse.env.$pres;
  13. var _ = converse.env._;
  14. var u = converse.env.utils;
  15. // See:
  16. // https://xmpp.org/rfcs/rfc3921.html
  17. describe("The Protocol", function () {
  18. describe("Integration of Roster Items and Presence Subscriptions", function () {
  19. // Stub the trimChat method. It causes havoc when running with
  20. // phantomJS.
  21. /* Some level of integration between roster items and presence
  22. * subscriptions is normally expected by an instant messaging user
  23. * regarding the user's subscriptions to and from other contacts. This
  24. * section describes the level of integration that MUST be supported
  25. * within an XMPP instant messaging applications.
  26. *
  27. * There are four primary subscription states:
  28. *
  29. * None -- the user does not have a subscription to the contact's
  30. * presence information, and the contact does not have a subscription
  31. * to the user's presence information
  32. * To -- the user has a subscription to the contact's presence
  33. * information, but the contact does not have a subscription to the
  34. * user's presence information
  35. * From -- the contact has a subscription to the user's presence
  36. * information, but the user does not have a subscription to the
  37. * contact's presence information
  38. * Both -- both the user and the contact have subscriptions to each
  39. * other's presence information (i.e., the union of 'from' and 'to')
  40. *
  41. * Each of these states is reflected in the roster of both the user and
  42. * the contact, thus resulting in durable subscription states.
  43. *
  44. * The 'from' and 'to' addresses are OPTIONAL in roster pushes; if
  45. * included, their values SHOULD be the full JID of the resource for
  46. * that session. A client MUST acknowledge each roster push with an IQ
  47. * stanza of type "result".
  48. */
  49. it("Subscribe to contact, contact accepts and subscribes back",
  50. mock.initConverseWithPromises(
  51. null, ['rosterGroupsFetched'],
  52. { roster_groups: false },
  53. function (done, _converse) {
  54. var contact, sent_stanza, IQ_id, stanza, modal;
  55. test_utils.waitUntilDiscoConfirmed(_converse, 'localhost', [], ['vcard-temp'])
  56. .then(function () {
  57. return test_utils.waitUntil(function () {
  58. return _converse.xmppstatus.get('fullname');
  59. }, 300);
  60. }).then(function () {
  61. /* The process by which a user subscribes to a contact, including
  62. * the interaction between roster items and subscription states.
  63. */
  64. test_utils.openControlBox(_converse);
  65. var cbview = _converse.chatboxviews.get('controlbox');
  66. spyOn(_converse.roster, "addAndSubscribe").and.callThrough();
  67. spyOn(_converse.roster, "addContact").and.callThrough();
  68. spyOn(_converse.roster, "sendContactAddIQ").and.callThrough();
  69. spyOn(_converse.api.vcard, "get").and.callThrough();
  70. var sendIQ = _converse.connection.sendIQ;
  71. spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
  72. sent_stanza = iq;
  73. IQ_id = sendIQ.bind(this)(iq, callback, errback);
  74. });
  75. cbview.el.querySelector('.add-contact').click()
  76. modal = _converse.rosterview.add_contact_modal;
  77. return test_utils.waitUntil(function () {
  78. return u.isVisible(modal.el);
  79. }, 1000);
  80. }).then(function () {
  81. spyOn(modal, "addContactFromForm").and.callThrough();
  82. modal.delegateEvents();
  83. // Fill in the form and submit
  84. var form = modal.el.querySelector('form.add-xmpp-contact');
  85. form.querySelector('input').value = 'contact@example.org';
  86. form.querySelector('[type="submit"]').click();
  87. /* In preparation for being able to render the contact in the
  88. * user's client interface and for the server to keep track of the
  89. * subscription, the user's client SHOULD perform a "roster set"
  90. * for the new roster item.
  91. */
  92. expect(modal.addContactFromForm).toHaveBeenCalled();
  93. expect(_converse.roster.addAndSubscribe).toHaveBeenCalled();
  94. expect(_converse.roster.addContact).toHaveBeenCalled();
  95. /* _converse request consists of sending an IQ
  96. * stanza of type='set' containing a <query/> element qualified by
  97. * the 'jabber:iq:roster' namespace, which in turn contains an
  98. * <item/> element that defines the new roster item; the <item/>
  99. * element MUST possess a 'jid' attribute, MAY possess a 'name'
  100. * attribute, MUST NOT possess a 'subscription' attribute, and MAY
  101. * contain one or more <group/> child elements:
  102. *
  103. * <iq type='set' id='set1'>
  104. * <query xmlns='jabber:iq:roster'>
  105. * <item
  106. * jid='contact@example.org'
  107. * name='MyContact'>
  108. * <group>MyBuddies</group>
  109. * </item>
  110. * </query>
  111. * </iq>
  112. */
  113. expect(_converse.roster.sendContactAddIQ).toHaveBeenCalled();
  114. expect(sent_stanza.toLocaleString()).toBe(
  115. "<iq type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
  116. "<query xmlns='jabber:iq:roster'>"+
  117. "<item jid='contact@example.org' name='contact@example.org'/>"+
  118. "</query>"+
  119. "</iq>"
  120. );
  121. /* As a result, the user's server (1) MUST initiate a roster push
  122. * for the new roster item to all available resources associated
  123. * with _converse user that have requested the roster, setting the
  124. * 'subscription' attribute to a value of "none"; and (2) MUST
  125. * reply to the sending resource with an IQ result indicating the
  126. * success of the roster set:
  127. *
  128. * <iq type='set'>
  129. * <query xmlns='jabber:iq:roster'>
  130. * <item
  131. * jid='contact@example.org'
  132. * subscription='none'
  133. * name='MyContact'>
  134. * <group>MyBuddies</group>
  135. * </item>
  136. * </query>
  137. * </iq>
  138. */
  139. var create = _converse.roster.create;
  140. var sent_stanzas = [];
  141. spyOn(_converse.connection, 'send').and.callFake(function (stanza) {
  142. sent_stanza = stanza;
  143. sent_stanzas.push(stanza.toLocaleString());
  144. });
  145. spyOn(_converse.roster, 'create').and.callFake(function () {
  146. contact = create.apply(_converse.roster, arguments);
  147. spyOn(contact, 'subscribe').and.callThrough();
  148. return contact;
  149. });
  150. stanza = $iq({'type': 'set'}).c('query', {'xmlns': 'jabber:iq:roster'})
  151. .c('item', {
  152. 'jid': 'contact@example.org',
  153. 'subscription': 'none',
  154. 'name': 'contact@example.org'});
  155. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  156. /*
  157. * <iq type='result' id='set1'/>
  158. */
  159. stanza = $iq({'type': 'result', 'id':IQ_id});
  160. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  161. // A contact should now have been created
  162. expect(_converse.roster.get('contact@example.org') instanceof _converse.RosterContact).toBeTruthy();
  163. expect(contact.get('jid')).toBe('contact@example.org');
  164. expect(_converse.api.vcard.get).toHaveBeenCalled();
  165. /* To subscribe to the contact's presence information,
  166. * the user's client MUST send a presence stanza of
  167. * type='subscribe' to the contact:
  168. *
  169. * <presence to='contact@example.org' type='subscribe'/>
  170. */
  171. return test_utils.waitUntil(function () {
  172. return sent_stanzas.length == 1;
  173. }, 300);
  174. }).then(function () {
  175. expect(contact.subscribe).toHaveBeenCalled();
  176. expect(sent_stanza.toLocaleString()).toBe( // Strophe adds the xmlns attr (although not in spec)
  177. "<presence to='contact@example.org' type='subscribe' xmlns='jabber:client'>"+
  178. "<nick xmlns='http://jabber.org/protocol/nick'>Max Mustermann</nick>"+
  179. "</presence>"
  180. );
  181. /* As a result, the user's server MUST initiate a second roster
  182. * push to all of the user's available resources that have
  183. * requested the roster, setting the contact to the pending
  184. * sub-state of the 'none' subscription state; _converse pending
  185. * sub-state is denoted by the inclusion of the ask='subscribe'
  186. * attribute in the roster item:
  187. *
  188. * <iq type='set'>
  189. * <query xmlns='jabber:iq:roster'>
  190. * <item
  191. * jid='contact@example.org'
  192. * subscription='none'
  193. * ask='subscribe'
  194. * name='MyContact'>
  195. * <group>MyBuddies</group>
  196. * </item>
  197. * </query>
  198. * </iq>
  199. */
  200. spyOn(_converse.roster, "updateContact").and.callThrough();
  201. stanza = $iq({'type': 'set', 'from': 'dummy@localhost'})
  202. .c('query', {'xmlns': 'jabber:iq:roster'})
  203. .c('item', {
  204. 'jid': 'contact@example.org',
  205. 'subscription': 'none',
  206. 'ask': 'subscribe',
  207. 'name': 'contact@example.org'});
  208. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  209. expect(_converse.roster.updateContact).toHaveBeenCalled();
  210. // Check that the user is now properly shown as a pending
  211. // contact in the roster.
  212. return test_utils.waitUntil(function () {
  213. var $header = $('a:contains("Pending contacts")');
  214. var $contacts = $header.parent().find('li:visible');
  215. return $contacts.length;
  216. }, 600);
  217. }).then(function () {
  218. var $header = $('a:contains("Pending contacts")');
  219. var $contacts = $header.parent().find('li');
  220. expect($contacts.length).toBe(1);
  221. expect($contacts.is(':visible')).toBeTruthy();
  222. spyOn(contact, "ackSubscribe").and.callThrough();
  223. /* Here we assume the "happy path" that the contact
  224. * approves the subscription request
  225. *
  226. * <presence
  227. * to='user@example.com'
  228. * from='contact@example.org'
  229. * type='subscribed'/>
  230. */
  231. stanza = $pres({
  232. 'to': _converse.bare_jid,
  233. 'from': 'contact@example.org',
  234. 'type': 'subscribed'
  235. });
  236. sent_stanza = ""; // Reset
  237. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  238. /* Upon receiving the presence stanza of type "subscribed",
  239. * the user SHOULD acknowledge receipt of that
  240. * subscription state notification by sending a presence
  241. * stanza of type "subscribe".
  242. */
  243. expect(contact.ackSubscribe).toHaveBeenCalled();
  244. expect(sent_stanza.toLocaleString()).toBe( // Strophe adds the xmlns attr (although not in spec)
  245. "<presence type='subscribe' to='contact@example.org' xmlns='jabber:client'/>"
  246. );
  247. /* The user's server MUST initiate a roster push to all of the user's
  248. * available resources that have requested the roster,
  249. * containing an updated roster item for the contact with
  250. * the 'subscription' attribute set to a value of "to";
  251. *
  252. * <iq type='set'>
  253. * <query xmlns='jabber:iq:roster'>
  254. * <item
  255. * jid='contact@example.org'
  256. * subscription='to'
  257. * name='MyContact'>
  258. * <group>MyBuddies</group>
  259. * </item>
  260. * </query>
  261. * </iq>
  262. */
  263. IQ_id = _converse.connection.getUniqueId('roster');
  264. stanza = $iq({'type': 'set', 'id': IQ_id})
  265. .c('query', {'xmlns': 'jabber:iq:roster'})
  266. .c('item', {
  267. 'jid': 'contact@example.org',
  268. 'subscription': 'to',
  269. 'name': 'contact@example.org'});
  270. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  271. // Check that the IQ set was acknowledged.
  272. expect(sent_stanza.toLocaleString()).toBe( // Strophe adds the xmlns attr (although not in spec)
  273. "<iq type='result' id='"+IQ_id+"' from='dummy@localhost/resource' xmlns='jabber:client'/>"
  274. );
  275. expect(_converse.roster.updateContact).toHaveBeenCalled();
  276. // The contact should now be visible as an existing
  277. // contact (but still offline).
  278. return test_utils.waitUntil(function () {
  279. var $header = $('a:contains("My contacts")');
  280. var $contacts = $header.parent().find('li:visible');
  281. return $contacts.length;
  282. }, 600);
  283. }).then(function () {
  284. var $header = $('a:contains("My contacts")');
  285. expect($header.length).toBe(1);
  286. expect($header.is(":visible")).toBeTruthy();
  287. var $contacts = $header.parent().find('li');
  288. expect($contacts.length).toBe(1);
  289. // Check that it has the right classes and text
  290. expect($contacts.hasClass('to')).toBeTruthy();
  291. expect($contacts.hasClass('both')).toBeFalsy();
  292. expect($contacts.hasClass('current-xmpp-contact')).toBeTruthy();
  293. expect($contacts.text().trim()).toBe('Contact');
  294. expect(contact.get('chat_status')).toBe('offline');
  295. /* <presence
  296. * from='contact@example.org/resource'
  297. * to='user@example.com/resource'/>
  298. */
  299. stanza = $pres({'to': _converse.bare_jid, 'from': 'contact@example.org/resource'});
  300. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  301. // Now the contact should also be online.
  302. expect(contact.get('chat_status')).toBe('online');
  303. /* Section 8.3. Creating a Mutual Subscription
  304. *
  305. * If the contact wants to create a mutual subscription,
  306. * the contact MUST send a subscription request to the
  307. * user.
  308. *
  309. * <presence from='contact@example.org' to='user@example.com' type='subscribe'/>
  310. */
  311. spyOn(contact, 'authorize').and.callThrough();
  312. spyOn(_converse.roster, 'handleIncomingSubscription').and.callThrough();
  313. stanza = $pres({
  314. 'to': _converse.bare_jid,
  315. 'from': 'contact@example.org/resource',
  316. 'type': 'subscribe'});
  317. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  318. expect(_converse.roster.handleIncomingSubscription).toHaveBeenCalled();
  319. /* The user's client MUST send a presence stanza of type
  320. * "subscribed" to the contact in order to approve the
  321. * subscription request.
  322. *
  323. * <presence to='contact@example.org' type='subscribed'/>
  324. */
  325. expect(contact.authorize).toHaveBeenCalled();
  326. expect(sent_stanza.toLocaleString()).toBe(
  327. "<presence to='contact@example.org' type='subscribed' xmlns='jabber:client'/>"
  328. );
  329. /* As a result, the user's server MUST initiate a
  330. * roster push containing a roster item for the
  331. * contact with the 'subscription' attribute set to
  332. * a value of "both".
  333. *
  334. * <iq type='set'>
  335. * <query xmlns='jabber:iq:roster'>
  336. * <item
  337. * jid='contact@example.org'
  338. * subscription='both'
  339. * name='MyContact'>
  340. * <group>MyBuddies</group>
  341. * </item>
  342. * </query>
  343. * </iq>
  344. */
  345. stanza = $iq({'type': 'set'}).c('query', {'xmlns': 'jabber:iq:roster'})
  346. .c('item', {
  347. 'jid': 'contact@example.org',
  348. 'subscription': 'both',
  349. 'name': 'contact@example.org'});
  350. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  351. expect(_converse.roster.updateContact).toHaveBeenCalled();
  352. // The class on the contact will now have switched.
  353. expect($contacts.hasClass('to')).toBeFalsy();
  354. expect($contacts.hasClass('both')).toBeTruthy();
  355. done();
  356. });
  357. }));
  358. it("Alternate Flow: Contact Declines Subscription Request",
  359. mock.initConverseWithPromises(
  360. null, ['rosterGroupsFetched'], {},
  361. function (done, _converse) {
  362. /* The process by which a user subscribes to a contact, including
  363. * the interaction between roster items and subscription states.
  364. */
  365. var contact, stanza, sent_stanza, sent_IQ;
  366. test_utils.openControlBox(_converse);
  367. // Add a new roster contact via roster push
  368. stanza = $iq({'type': 'set'}).c('query', {'xmlns': 'jabber:iq:roster'})
  369. .c('item', {
  370. 'jid': 'contact@example.org',
  371. 'subscription': 'none',
  372. 'ask': 'subscribe',
  373. 'name': 'contact@example.org'});
  374. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  375. // A pending contact should now exist.
  376. contact = _converse.roster.get('contact@example.org');
  377. expect(_converse.roster.get('contact@example.org') instanceof _converse.RosterContact).toBeTruthy();
  378. spyOn(contact, "ackUnsubscribe").and.callThrough();
  379. spyOn(_converse.connection, 'send').and.callFake(function (stanza) {
  380. sent_stanza = stanza;
  381. });
  382. spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
  383. sent_IQ = iq;
  384. });
  385. /* We now assume the contact declines the subscription
  386. * requests.
  387. *
  388. * Upon receiving the presence stanza of type "unsubscribed"
  389. * addressed to the user, the user's server (1) MUST deliver
  390. * that presence stanza to the user and (2) MUST initiate a
  391. * roster push to all of the user's available resources that
  392. * have requested the roster, containing an updated roster
  393. * item for the contact with the 'subscription' attribute
  394. * set to a value of "none" and with no 'ask' attribute:
  395. *
  396. * <presence
  397. * from='contact@example.org'
  398. * to='user@example.com'
  399. * type='unsubscribed'/>
  400. *
  401. * <iq type='set'>
  402. * <query xmlns='jabber:iq:roster'>
  403. * <item
  404. * jid='contact@example.org'
  405. * subscription='none'
  406. * name='MyContact'>
  407. * <group>MyBuddies</group>
  408. * </item>
  409. * </query>
  410. * </iq>
  411. */
  412. // FIXME: also add the <iq>
  413. stanza = $pres({
  414. 'to': _converse.bare_jid,
  415. 'from': 'contact@example.org',
  416. 'type': 'unsubscribed'
  417. });
  418. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  419. /* Upon receiving the presence stanza of type "unsubscribed",
  420. * the user SHOULD acknowledge receipt of that subscription
  421. * state notification through either "affirming" it by
  422. * sending a presence stanza of type "unsubscribe
  423. */
  424. expect(contact.ackUnsubscribe).toHaveBeenCalled();
  425. expect(sent_stanza.toLocaleString()).toBe(
  426. "<presence type='unsubscribe' to='contact@example.org' xmlns='jabber:client'/>"
  427. );
  428. /* _converse.js will then also automatically remove the
  429. * contact from the user's roster.
  430. */
  431. expect(sent_IQ.toLocaleString()).toBe(
  432. "<iq type='set' xmlns='jabber:client'>"+
  433. "<query xmlns='jabber:iq:roster'>"+
  434. "<item jid='contact@example.org' subscription='remove'/>"+
  435. "</query>"+
  436. "</iq>"
  437. );
  438. done();
  439. }));
  440. it("Unsubscribe to a contact when subscription is mutual",
  441. mock.initConverseWithPromises(
  442. null, ['rosterGroupsFetched'],
  443. { roster_groups: false },
  444. function (done, _converse) {
  445. var sent_IQ, IQ_id, jid = 'annegreet.gomez@localhost';
  446. test_utils.openControlBox(_converse);
  447. test_utils.createContacts(_converse, 'current');
  448. spyOn(window, 'confirm').and.returnValue(true);
  449. // We now have a contact we want to remove
  450. expect(_converse.roster.get(jid) instanceof _converse.RosterContact).toBeTruthy();
  451. var sendIQ = _converse.connection.sendIQ;
  452. spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
  453. sent_IQ = iq;
  454. IQ_id = sendIQ.bind(this)(iq, callback, errback);
  455. });
  456. return test_utils.waitUntil(function () {
  457. var $header = $('a:contains("My contacts")');
  458. var $contacts = $header.parent().find('li');
  459. return $contacts.length;
  460. }, 600).then(function () {
  461. var $header = $('a:contains("My contacts")');
  462. // remove the first user
  463. $header.parent().find('li .remove-xmpp-contact').get(0).click();
  464. expect(window.confirm).toHaveBeenCalled();
  465. /* Section 8.6 Removing a Roster Item and Cancelling All
  466. * Subscriptions
  467. *
  468. * First the user is removed from the roster
  469. * Because there may be many steps involved in completely
  470. * removing a roster item and cancelling subscriptions in
  471. * both directions, the roster management protocol includes
  472. * a "shortcut" method for doing so. The process may be
  473. * initiated no matter what the current subscription state
  474. * is by sending a roster set containing an item for the
  475. * contact with the 'subscription' attribute set to a value
  476. * of "remove":
  477. *
  478. * <iq type='set' id='remove1'>
  479. * <query xmlns='jabber:iq:roster'>
  480. * <item jid='contact@example.org' subscription='remove'/>
  481. * </query>
  482. * </iq>
  483. */
  484. expect(sent_IQ.toLocaleString()).toBe(
  485. "<iq type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
  486. "<query xmlns='jabber:iq:roster'>"+
  487. "<item jid='annegreet.gomez@localhost' subscription='remove'/>"+
  488. "</query>"+
  489. "</iq>");
  490. // Receive confirmation from the contact's server
  491. // <iq type='result' id='remove1'/>
  492. var stanza = $iq({'type': 'result', 'id':IQ_id});
  493. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  494. // Our contact has now been removed
  495. expect(typeof _converse.roster.get(jid) === "undefined").toBeTruthy();
  496. done();
  497. });
  498. }));
  499. it("Receiving a subscription request", mock.initConverseWithPromises(
  500. null, ['rosterGroupsFetched'], {},
  501. function (done, _converse) {
  502. spyOn(_converse, "emit");
  503. test_utils.openControlBox(_converse);
  504. test_utils.createContacts(_converse, 'current'); // Create some contacts so that we can test positioning
  505. /* <presence
  506. * from='user@example.com'
  507. * to='contact@example.org'
  508. * type='subscribe'/>
  509. */
  510. var stanza = $pres({
  511. 'to': _converse.bare_jid,
  512. 'from': 'contact@example.org',
  513. 'type': 'subscribe'
  514. }).c('nick', {
  515. 'xmlns': Strophe.NS.NICK,
  516. }).t('Clint Contact');
  517. _converse.connection._dataRecv(test_utils.createRequest(stanza));
  518. return test_utils.waitUntil(function () {
  519. var $header = $('a:contains("Contact requests")');
  520. var $contacts = $header.parent().find('li:visible');
  521. return $contacts.length;
  522. }, 600).then(function () {
  523. expect(_converse.emit).toHaveBeenCalledWith('contactRequest', jasmine.any(Object));
  524. var $header = $('a:contains("Contact requests")');
  525. expect($header.length).toBe(1);
  526. expect($header.is(":visible")).toBeTruthy();
  527. var $contacts = $header.parent().find('li');
  528. expect($contacts.length).toBe(1);
  529. done();
  530. });
  531. }));
  532. });
  533. });
  534. }));