mirror of https://github.com/zulip/zulip.git
Revert unused code for creating non-editable pills.
We don't use input.create_non_editable_pill() in our
code yet. If we add this back, we'll want to have node
tests on it.
Removing this unused code brings us to 100% line
coverage for input_pill.js.
This directly reverts 5c11ab85
with the small addition
of adding input_pill to our list of fully covered
modules.
This commit is contained in:
parent
9b0c702035
commit
336c2cee20
|
@ -377,61 +377,6 @@ exports.create = function (opts) {
|
|||
return prototype;
|
||||
};
|
||||
|
||||
// Following function is used for creating non-editable pills.
|
||||
exports.create_non_editable_pills = function (opts) {
|
||||
|
||||
if (!opts.container) {
|
||||
blueslip.error('Pill needs container.');
|
||||
return;
|
||||
}
|
||||
|
||||
var store = {
|
||||
pills: [],
|
||||
$parent: opts.container,
|
||||
};
|
||||
|
||||
var funcs = {
|
||||
// This is generally called by typeahead logic, where we have all
|
||||
// the data we need (as opposed to, say, just a user-typed email).
|
||||
appendValidatedData: function (item) {
|
||||
var id = exports.random_id();
|
||||
|
||||
if (!item.display_value) {
|
||||
blueslip.error('no display_value returned');
|
||||
return;
|
||||
}
|
||||
|
||||
var payload = {
|
||||
id: id,
|
||||
item: item,
|
||||
};
|
||||
|
||||
store.pills.push(payload);
|
||||
|
||||
var opts = {
|
||||
id: payload.id,
|
||||
display_value: item.display_value,
|
||||
cannot_edit: true,
|
||||
};
|
||||
|
||||
var pill_html = templates.render('input_pill', opts);
|
||||
payload.$element = $(pill_html);
|
||||
store.$parent.append(payload.$element);
|
||||
},
|
||||
|
||||
items: function () {
|
||||
return _.pluck(store.pills, 'item');
|
||||
},
|
||||
};
|
||||
|
||||
var prototype = {
|
||||
appendValidatedData: funcs.appendValidatedData.bind(funcs),
|
||||
items: funcs.items,
|
||||
};
|
||||
|
||||
return prototype;
|
||||
|
||||
};
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
|
|
@ -65,9 +65,7 @@ exports.append_person = function (opts) {
|
|||
email: person.email,
|
||||
img_src: avatar_url,
|
||||
});
|
||||
if (pill_widget.clear_text !== undefined) {
|
||||
pill_widget.clear_text();
|
||||
}
|
||||
};
|
||||
|
||||
exports.get_user_ids = function (pill_widget) {
|
||||
|
|
|
@ -45,6 +45,7 @@ enforce_fully_covered = {
|
|||
'static/js/filter.js',
|
||||
'static/js/hash_util.js',
|
||||
'static/js/keydown_util.js',
|
||||
'static/js/input_pill.js',
|
||||
'static/js/list_cursor.js',
|
||||
'static/js/markdown.js',
|
||||
'static/js/message_store.js',
|
||||
|
|
Loading…
Reference in New Issue