mirror of https://github.com/zulip/zulip.git
node test: Remove complicated pm_list test.
This test mostly tests logic that I'm about to remove in subsequent commits, and it's a bit messy. This commit removes 100% line coverage, but I will restore that a few commits later.
This commit is contained in:
parent
066a02a987
commit
da1392efd2
|
@ -160,91 +160,6 @@ run_test('build_private_messages_list_bot', () => {
|
||||||
assert.deepEqual(template_data, expected_data);
|
assert.deepEqual(template_data, expected_data);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test('expand_and_update_private_messages', () => {
|
|
||||||
global.stub_templates(function (template_name) {
|
|
||||||
assert.equal(template_name, 'sidebar_private_message_list');
|
|
||||||
return 'fake-dom-for-pm-list';
|
|
||||||
});
|
|
||||||
|
|
||||||
const private_li = $(".top_left_private_messages");
|
|
||||||
const alice_li = $.create('alice-li-stub');
|
|
||||||
const bob_li = $.create('bob-li-stub');
|
|
||||||
|
|
||||||
private_li.set_find_results("li[data-user-ids-string='101']", alice_li);
|
|
||||||
private_li.set_find_results("li[data-user-ids-string='102']", bob_li);
|
|
||||||
|
|
||||||
let dom;
|
|
||||||
$('#private-container').html = function (html) {
|
|
||||||
dom = html;
|
|
||||||
};
|
|
||||||
|
|
||||||
pm_list.expand([alice.email, bob.email]);
|
|
||||||
assert.equal(dom, 'fake-dom-for-pm-list');
|
|
||||||
assert(!alice_li.hasClass('active-sub-filter'));
|
|
||||||
|
|
||||||
pm_list.expand([alice.email]);
|
|
||||||
assert.equal(dom, 'fake-dom-for-pm-list');
|
|
||||||
assert(alice_li.hasClass('active-sub-filter'));
|
|
||||||
|
|
||||||
pm_list.expand([]);
|
|
||||||
assert.equal(dom, 'fake-dom-for-pm-list');
|
|
||||||
|
|
||||||
// Next, simulate clicking on Bob.
|
|
||||||
narrow_state.active = function () { return true; };
|
|
||||||
|
|
||||||
narrow_state.filter = function () {
|
|
||||||
return {
|
|
||||||
operands: function (operand) {
|
|
||||||
if (operand === 'is') {
|
|
||||||
return 'private';
|
|
||||||
}
|
|
||||||
assert.equal(operand, 'pm-with');
|
|
||||||
return [bob.email, alice.email];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
pm_list.update_private_messages();
|
|
||||||
|
|
||||||
assert(!bob_li.hasClass('active-sub-filter'));
|
|
||||||
|
|
||||||
narrow_state.filter = function () {
|
|
||||||
return {
|
|
||||||
operands: function (operand) {
|
|
||||||
if (operand === 'is') {
|
|
||||||
return ['private'];
|
|
||||||
}
|
|
||||||
assert.equal(operand, 'pm-with');
|
|
||||||
return [];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
pm_list.update_private_messages();
|
|
||||||
|
|
||||||
assert(!bob_li.hasClass('active-sub-filter'));
|
|
||||||
|
|
||||||
narrow_state.filter = function () {
|
|
||||||
return {
|
|
||||||
operands: function (operand) {
|
|
||||||
if (operand === 'is') {
|
|
||||||
return ['private'];
|
|
||||||
}
|
|
||||||
assert.equal(operand, 'pm-with');
|
|
||||||
return [bob.email];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
pm_list.update_private_messages();
|
|
||||||
|
|
||||||
assert(bob_li.hasClass('active-sub-filter'));
|
|
||||||
|
|
||||||
narrow_state.active = function () { return false; };
|
|
||||||
pm_list.update_private_messages();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
run_test('update_dom_with_unread_counts', () => {
|
run_test('update_dom_with_unread_counts', () => {
|
||||||
const total_value = $.create('total-value-stub');
|
const total_value = $.create('total-value-stub');
|
||||||
const total_count = $.create('total-count-stub');
|
const total_count = $.create('total-count-stub');
|
||||||
|
|
|
@ -59,7 +59,6 @@ enforce_fully_covered = {
|
||||||
'static/js/narrow_state.js',
|
'static/js/narrow_state.js',
|
||||||
'static/js/people.js',
|
'static/js/people.js',
|
||||||
'static/js/pm_conversations.js',
|
'static/js/pm_conversations.js',
|
||||||
'static/js/pm_list.js',
|
|
||||||
'static/js/presence.js',
|
'static/js/presence.js',
|
||||||
'static/js/reactions.js',
|
'static/js/reactions.js',
|
||||||
'static/js/recent_senders.js',
|
'static/js/recent_senders.js',
|
||||||
|
|
Loading…
Reference in New Issue