Add missing CSS class to bookmark list item and fix test

updates #1069
This commit is contained in:
JC Brand 2018-07-04 11:23:45 +02:00
parent 388719ff2d
commit 7b86e24b9a
3 changed files with 18 additions and 10 deletions

2
dist/converse.js vendored
View File

@ -83944,7 +83944,7 @@ __p += ' hidden ';
} ; } ;
__p += '" data-room-jid="' + __p += '" data-room-jid="' +
__e(o.jid) + __e(o.jid) +
'">\n <a class="open-room w-100" data-room-jid="' + '">\n <a class="list-item-link open-room w-100" data-room-jid="' +
__e(o.jid) + __e(o.jid) +
'" title="' + '" title="' +
__e(o.open_title) + __e(o.open_title) +

View File

@ -516,20 +516,28 @@
_converse.connection._dataRecv(test_utils.createRequest(stanza)); _converse.connection._dataRecv(test_utils.createRequest(stanza));
test_utils.waitUntil(function () { test_utils.waitUntil(function () {
return $('#chatrooms div.bookmarks.rooms-list .room-item').length; return document.querySelectorAll('#chatrooms div.bookmarks.rooms-list .room-item').length;
}, 300).then(function () { }, 300).then(function () {
expect($('#chatrooms div.bookmarks.rooms-list .room-item').length).toBe(4); expect(document.querySelectorAll('#chatrooms div.bookmarks.rooms-list .room-item').length).toBe(4);
expect($('#chatrooms div.bookmarks.rooms-list .room-item a').text().trim()).toBe( const els = document.querySelectorAll('#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link');
"1st Bookmark  Another room  Bookmark with a very very long name that will be shortened  The Play's the Thing") expect(els[0].textContent).toBe("1st Bookmark");
expect(els[1].textContent).toBe("Another room");
expect(els[2].textContent).toBe("Bookmark with a very very long name that will be shortened");
expect(els[3].textContent).toBe("The Play's the Thing");
spyOn(window, 'confirm').and.returnValue(true); spyOn(window, 'confirm').and.returnValue(true);
$('#chatrooms .bookmarks.rooms-list .room-item:nth-child(2) a:nth-child(2)')[0].click(); document.querySelector('#chatrooms .bookmarks.rooms-list .room-item:nth-child(2) a:nth-child(2)').click();
expect(window.confirm).toHaveBeenCalled(); expect(window.confirm).toHaveBeenCalled();
return test_utils.waitUntil(function () { return test_utils.waitUntil(function () {
return $('#chatrooms .bookmarks.rooms-list .room-item a').text().trim() === return document.querySelectorAll('#chatrooms div.bookmarks.rooms-list .room-item').length === 3;
"1st Bookmark  Bookmark with a very very long name that will be shortened  The Play's the Thing";
}, 300) }, 300)
}).then(done); }).then(() => {
const els = document.querySelectorAll('#chatrooms div.bookmarks.rooms-list .room-item a.list-item-link');
expect(els[0].textContent).toBe("1st Bookmark");
expect(els[1].textContent).toBe("Bookmark with a very very long name that will be shortened");
expect(els[2].textContent).toBe("The Play's the Thing");
done();
}).catch(_.partial(console.error, _));
}); });
})); }));

View File

@ -1,5 +1,5 @@
<div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row {[ if (o.hidden) { ]} hidden {[ } ]}" data-room-jid="{{{o.jid}}}"> <div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row {[ if (o.hidden) { ]} hidden {[ } ]}" data-room-jid="{{{o.jid}}}">
<a class="open-room w-100" data-room-jid="{{{o.jid}}}" title="{{{o.open_title}}}" href="#">{{{o.name}}}</a> <a class="list-item-link open-room w-100" data-room-jid="{{{o.jid}}}" title="{{{o.open_title}}}" href="#">{{{o.name}}}</a>
<a class="list-item-action remove-bookmark fa fa-bookmark align-self-center {[ if (o.bookmarked) { ]} button-on {[ } ]}" <a class="list-item-action remove-bookmark fa fa-bookmark align-self-center {[ if (o.bookmarked) { ]} button-on {[ } ]}"
data-room-jid="{{{o.jid}}}" data-bookmark-name="{{{o.name}}}" data-room-jid="{{{o.jid}}}" data-bookmark-name="{{{o.name}}}"
title="{{{o.info_remove_bookmark}}}" href="#">&nbsp;</a> title="{{{o.info_remove_bookmark}}}" href="#">&nbsp;</a>