mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
node_tests: Cover a compose PM recipients typeahead corner case .
This commit is contained in:
@@ -181,10 +181,6 @@ var backend = {
|
|||||||
global.user_groups.add(hamletcharacters);
|
global.user_groups.add(hamletcharacters);
|
||||||
global.user_groups.add(backend);
|
global.user_groups.add(backend);
|
||||||
|
|
||||||
user_pill.get_user_ids = function () {
|
|
||||||
return [];
|
|
||||||
};
|
|
||||||
|
|
||||||
run_test('topics_seen_for', () => {
|
run_test('topics_seen_for', () => {
|
||||||
topic_data.get_recent_names = (stream_id) => {
|
topic_data.get_recent_names = (stream_id) => {
|
||||||
assert.equal(stream_id, denmark_stream.stream_id);
|
assert.equal(stream_id, denmark_stream.stream_id);
|
||||||
@@ -473,6 +469,11 @@ run_test('initialize', () => {
|
|||||||
|
|
||||||
var pm_recipient_typeahead_called = false;
|
var pm_recipient_typeahead_called = false;
|
||||||
$('#private_message_recipient').typeahead = function (options) {
|
$('#private_message_recipient').typeahead = function (options) {
|
||||||
|
var inserted_users = [];
|
||||||
|
user_pill.get_user_ids = function () {
|
||||||
|
return inserted_users;
|
||||||
|
};
|
||||||
|
|
||||||
// This should match the users added at the beginning of this test file.
|
// This should match the users added at the beginning of this test file.
|
||||||
var actual_value = options.source();
|
var actual_value = options.source();
|
||||||
var expected_value = [hamlet, othello, cordelia, lear, hamletcharacters, backend];
|
var expected_value = [hamlet, othello, cordelia, lear, hamletcharacters, backend];
|
||||||
@@ -599,6 +600,13 @@ run_test('initialize', () => {
|
|||||||
assert.deepEqual(appended_names, ['King Lear']);
|
assert.deepEqual(appended_names, ['King Lear']);
|
||||||
assert(cleared);
|
assert(cleared);
|
||||||
|
|
||||||
|
inserted_users = [lear.user_id];
|
||||||
|
appended_names = [];
|
||||||
|
cleared = false;
|
||||||
|
options.updater(hamletcharacters, event);
|
||||||
|
assert.deepEqual(appended_names, []);
|
||||||
|
assert(cleared);
|
||||||
|
|
||||||
pm_recipient_typeahead_called = true;
|
pm_recipient_typeahead_called = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user