mirror of https://github.com/zulip/zulip.git
node tests: Use get_on_handler() in message_store.js.
This commit is contained in:
parent
99a6a9b70d
commit
6a8fa55521
|
@ -244,17 +244,16 @@ message_store.initialize();
|
||||||
set_global('message_list', {});
|
set_global('message_list', {});
|
||||||
set_global('home_msg_list', {});
|
set_global('home_msg_list', {});
|
||||||
|
|
||||||
var id_change_event = {
|
var event = {
|
||||||
name: 'message_id_changed',
|
|
||||||
data: {
|
|
||||||
old_id: 401,
|
old_id: 401,
|
||||||
new_id: 402,
|
new_id: 402,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var on_id_message_changed_func = $(document).get_on_handler('message_id_changed');
|
||||||
|
|
||||||
global.with_stub(function (stub) {
|
global.with_stub(function (stub) {
|
||||||
home_msg_list.change_message_id = stub.f;
|
home_msg_list.change_message_id = stub.f;
|
||||||
$(document).trigger(id_change_event);
|
on_id_message_changed_func(event);
|
||||||
var msg_id = stub.get_args('old', 'new');
|
var msg_id = stub.get_args('old', 'new');
|
||||||
assert.equal(msg_id.old, 401);
|
assert.equal(msg_id.old, 401);
|
||||||
assert.equal(msg_id.new, 402);
|
assert.equal(msg_id.new, 402);
|
||||||
|
@ -263,7 +262,7 @@ message_store.initialize();
|
||||||
home_msg_list.view = {};
|
home_msg_list.view = {};
|
||||||
global.with_stub(function (stub) {
|
global.with_stub(function (stub) {
|
||||||
home_msg_list.view.change_message_id = stub.f;
|
home_msg_list.view.change_message_id = stub.f;
|
||||||
$(document).trigger(id_change_event);
|
on_id_message_changed_func(event);
|
||||||
var msg_id = stub.get_args('old', 'new');
|
var msg_id = stub.get_args('old', 'new');
|
||||||
assert.equal(msg_id.old, 401);
|
assert.equal(msg_id.old, 401);
|
||||||
assert.equal(msg_id.new, 402);
|
assert.equal(msg_id.new, 402);
|
||||||
|
|
Loading…
Reference in New Issue