diff --git a/web/src/input_pill.ts b/web/src/input_pill.ts index 76de9ff196..e73b88c563 100644 --- a/web/src/input_pill.ts +++ b/web/src/input_pill.ts @@ -75,22 +75,7 @@ export type InputPillContainer = { _get_pills_for_testing: () => InputPill[]; }; -export function create(opts: InputPillCreateOptions): InputPillContainer | undefined { - if (!opts.$container) { - blueslip.error("Pill needs container."); - return undefined; - } - - if (!opts.create_item_from_text) { - blueslip.error("Pill needs create_item_from_text"); - return undefined; - } - - if (!opts.get_text_from_item) { - blueslip.error("Pill needs get_text_from_item"); - return undefined; - } - +export function create(opts: InputPillCreateOptions): InputPillContainer { // a stateful object of this `pill_container` instance. // all unique instance information is stored in here. const store: InputPillStore = { diff --git a/web/tests/input_pill.test.js b/web/tests/input_pill.test.js index a6bfd206b4..84bfe23345 100644 --- a/web/tests/input_pill.test.js +++ b/web/tests/input_pill.test.js @@ -51,28 +51,18 @@ run_test("basics", ({mock_template}) => { return html; }); - const config = {}; - - blueslip.expect("error", "Pill needs container."); - input_pill.create(config); - const $pill_input = $.create("pill_input"); const $container = $.create("container"); $container.set_find_results(".input", $pill_input); - blueslip.expect("error", "Pill needs create_item_from_text"); - config.$container = $container; - input_pill.create(config); - - blueslip.expect("error", "Pill needs get_text_from_item"); - config.create_item_from_text = noop; - input_pill.create(config); - - config.get_text_from_item = noop; - config.pill_config = { - show_user_status_emoji: true, - }; - const widget = input_pill.create(config); + const widget = input_pill.create({ + $container, + create_item_from_text: noop, + get_text_from_item: noop, + pill_config: { + show_user_status_emoji: true, + }, + }); const status_emoji_info = {emoji_code: 5}; // type for a pill can be any string but it needs to be