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:
Steve Howell 2018-08-26 19:41:49 +00:00 committed by Tim Abbott
parent 9b0c702035
commit 336c2cee20
3 changed files with 2 additions and 58 deletions

View File

@ -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;
}());

View File

@ -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();
}
pill_widget.clear_text();
};
exports.get_user_ids = function (pill_widget) {

View File

@ -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',