Fix lack of focus when reselecting the same conversation (#2032)

Closes #2032
Fixes #2023
This commit is contained in:
Daniel Gasienica 2018-04-04 15:47:33 -04:00
commit a76a4865f5
3 changed files with 43 additions and 1 deletions

View file

@ -28,8 +28,8 @@
$el = view.$el;
}
$el.prependTo(this.el);
conversation.trigger('opened');
}
conversation.trigger('opened');
},
});

View file

@ -624,6 +624,7 @@
<script type="text/javascript" src="views/attachment_view_test.js"></script>
<script type="text/javascript" src="views/timestamp_view_test.js"></script>
<script type="text/javascript" src="views/list_view_test.js"></script>
<script type="text/javascript" src="views/inbox_view_test.js"></script>
<script type="text/javascript" src="views/conversation_search_view_test.js"></script>
<script type="text/javascript" src="views/network_status_view_test.js"></script>
<script type="text/javascript" src="views/last_seen_indicator_view_test.js"></script>

View file

@ -0,0 +1,41 @@
describe('InboxView', function() {
var inboxView = new Whisper.InboxView({
model: {},
window: window,
initialLoadComplete: function() {}
}).render();
var conversation = new Whisper.Conversation({ id: '1234', type: 'private'});
describe('the conversation stack', function() {
it('should be rendered', function() {
assert.ok(inboxView.$('.conversation-stack').length === 1);
});
describe('opening a conversation', function() {
var triggeredOpenedCount = 0;
before(function() {
conversation.on('opened', function() {
triggeredOpenedCount++;
});
inboxView.conversation_stack.open(conversation);
});
it('should trigger an opened event', function() {
assert.ok(triggeredOpenedCount === 1);
});
describe('and then opening it again immediately', function() {
before(function() {
inboxView.conversation_stack.open(conversation);
});
it('should trigger the opened event again', function() {
assert.ok(triggeredOpenedCount === 2);
});
});
});
});
});