Commit 4331f920 authored by JC Brand's avatar JC Brand

Fix failing tests

parent c6d7317b
...@@ -75878,6 +75878,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -75878,6 +75878,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
toHTML() { toHTML() {
return tpl_chatroom_details_modal(_.extend(this.model.toJSON(), { return tpl_chatroom_details_modal(_.extend(this.model.toJSON(), {
'_': _,
'__': __, '__': __,
'display_name': __('Groupchat info for %1$s', this.model.getDisplayName()), 'display_name': __('Groupchat info for %1$s', this.model.getDisplayName()),
'num_occupants': this.model.occupants.length 'num_occupants': this.model.occupants.length
...@@ -84258,15 +84259,19 @@ __e(o.jid) + ...@@ -84258,15 +84259,19 @@ __e(o.jid) +
__e(o.__('Description')) + __e(o.__('Description')) +
'</strong>: ' + '</strong>: ' +
__e(o.description) + __e(o.description) +
'</p>\n <p class="room-info"><strong>' + '</p>\n ';
if (o.subject) { ;
__p += '\n <p class="room-info"><strong>' +
__e(o.__('Topic')) + __e(o.__('Topic')) +
'</strong>: ' + '</strong>: ' +
__e(o.subject.text) + __e(o._.get(o.subject, 'text')) +
'</p>\n <p class="room-info"><strong>' + '</p>\n <p class="room-info"><strong>' +
__e(o.__('Topic Author')) + __e(o.__('Topic author')) +
'</strong>: ' + '</strong>: ' +
__e(o.subject.author) + __e(o._.get(o.subject, 'author')) +
'</p>\n <p class="room-info"><strong>' + '</p>\n ';
} ;
__p += '\n <p class="room-info"><strong>' +
__e(o.__('Online users')) + __e(o.__('Online users')) +
'</strong>: ' + '</strong>: ' +
__e(o.num_occupants) + __e(o.num_occupants) +
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
const room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room"); const room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(1); expect(room_els.length).toBe(1);
var info_el = _converse.rooms_list_view.el.querySelector(".room-info"); const info_el = _converse.rooms_list_view.el.querySelector(".room-info");
info_el.click(); info_el.click();
const modal = view.model.room_details_modal; const modal = view.model.room_details_modal;
...@@ -122,8 +122,8 @@ ...@@ -122,8 +122,8 @@
}).then(() => { }).then(() => {
const modal = view.model.room_details_modal; const modal = view.model.room_details_modal;
let els = modal.el.querySelectorAll('p.room-info'); let els = modal.el.querySelectorAll('p.room-info');
expect(els[0].textContent).toBe("Room address (JID): coven@chat.shakespeare.lit") expect(els[0].textContent).toBe("Name: A Dark Cave")
expect(els[1].textContent).toBe("Name: A Dark Cave") expect(els[1].textContent).toBe("Room address (JID): coven@chat.shakespeare.lit")
expect(els[2].textContent).toBe("Description: This is the description") expect(els[2].textContent).toBe("Description: This is the description")
expect(els[3].textContent).toBe("Online users: 1") expect(els[3].textContent).toBe("Online users: 1")
const features_list = modal.el.querySelector('.features-list'); const features_list = modal.el.querySelector('.features-list');
...@@ -149,8 +149,17 @@ ...@@ -149,8 +149,17 @@
els = modal.el.querySelectorAll('p.room-info'); els = modal.el.querySelectorAll('p.room-info');
expect(els[3].textContent).toBe("Online users: 2") expect(els[3].textContent).toBe("Online users: 2")
view.model.set({'subject': {'author': 'someone', 'text': 'Hatching dark plots'}});
els = modal.el.querySelectorAll('p.room-info');
expect(els[0].textContent).toBe("Name: A Dark Cave")
expect(els[1].textContent).toBe("Room address (JID): coven@chat.shakespeare.lit")
expect(els[2].textContent).toBe("Description: This is the description")
expect(els[3].textContent).toBe("Topic: Hatching dark plots")
expect(els[4].textContent).toBe("Topic author: someone")
expect(els[5].textContent).toBe("Online users: 2")
done(); done();
}); }).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
})); }));
it("can be closed", mock.initConverseWithPromises( it("can be closed", mock.initConverseWithPromises(
......
...@@ -493,6 +493,7 @@ ...@@ -493,6 +493,7 @@
toHTML () { toHTML () {
return tpl_chatroom_details_modal(_.extend( return tpl_chatroom_details_modal(_.extend(
this.model.toJSON(), { this.model.toJSON(), {
'_': _,
'__': __, '__': __,
'display_name': __('Groupchat info for %1$s', this.model.getDisplayName()), 'display_name': __('Groupchat info for %1$s', this.model.getDisplayName()),
'num_occupants': this.model.occupants.length 'num_occupants': this.model.occupants.length
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
<p class="room-info"><strong>{{{o.__('Name')}}}</strong>: {{{o.name}}}</p> <p class="room-info"><strong>{{{o.__('Name')}}}</strong>: {{{o.name}}}</p>
<p class="room-info"><strong>{{{o.__('Room address (JID)')}}}</strong>: {{{o.jid}}}</p> <p class="room-info"><strong>{{{o.__('Room address (JID)')}}}</strong>: {{{o.jid}}}</p>
<p class="room-info"><strong>{{{o.__('Description')}}}</strong>: {{{o.description}}}</p> <p class="room-info"><strong>{{{o.__('Description')}}}</strong>: {{{o.description}}}</p>
<p class="room-info"><strong>{{{o.__('Topic')}}}</strong>: {{{o.subject.text}}}</p> {[ if (o.subject) { ]}
<p class="room-info"><strong>{{{o.__('Topic Author')}}}</strong>: {{{o.subject.author}}}</p> <p class="room-info"><strong>{{{o.__('Topic')}}}</strong>: {{{o._.get(o.subject, 'text')}}}</p>
<p class="room-info"><strong>{{{o.__('Topic author')}}}</strong>: {{{o._.get(o.subject, 'author')}}}</p>
{[ } ]}
<p class="room-info"><strong>{{{o.__('Online users')}}}</strong>: {{{o.num_occupants}}}</p> <p class="room-info"><strong>{{{o.__('Online users')}}}</strong>: {{{o.num_occupants}}}</p>
<p class="room-info"><strong>{{{o.__('Features')}}}</strong>: <p class="room-info"><strong>{{{o.__('Features')}}}</strong>:
<div class="chatroom-features"> <div class="chatroom-features">
......
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