mirror of https://github.com/zulip/zulip.git
tests: Clean up duplicate setup for input_pill.
We just set pill_input.before to a noop for all of our tests in set_up, and callers can always override it with more specific implementations.
This commit is contained in:
parent
3745d44bed
commit
1600529a8b
|
@ -120,6 +120,8 @@ function set_up() {
|
|||
|
||||
var pill_input = $.create('pill_input');
|
||||
|
||||
pill_input.before = () => {};
|
||||
|
||||
var create_item_from_text = function (text) {
|
||||
return items[text];
|
||||
};
|
||||
|
@ -146,13 +148,9 @@ function set_up() {
|
|||
run_test('left arrow on input', () => {
|
||||
const info = set_up();
|
||||
const config = info.config;
|
||||
const pill_input = info.pill_input;
|
||||
const container = info.container;
|
||||
|
||||
const widget = input_pill.create(config);
|
||||
|
||||
pill_input.before = () => {};
|
||||
|
||||
widget.appendValue('blue,red');
|
||||
|
||||
const LEFT_ARROW = 37;
|
||||
|
@ -185,9 +183,6 @@ run_test('comma', () => {
|
|||
const container = info.container;
|
||||
|
||||
const widget = input_pill.create(config);
|
||||
|
||||
pill_input.before = () => {};
|
||||
|
||||
widget.appendValue('blue,red');
|
||||
|
||||
assert.deepEqual(widget.items(), [
|
||||
|
@ -227,13 +222,9 @@ run_test('enter key with text', () => {
|
|||
const info = set_up();
|
||||
const config = info.config;
|
||||
const items = info.items;
|
||||
const pill_input = info.pill_input;
|
||||
const container = info.container;
|
||||
|
||||
const widget = input_pill.create(config);
|
||||
|
||||
pill_input.before = () => {};
|
||||
|
||||
widget.appendValue('blue,red');
|
||||
|
||||
assert.deepEqual(widget.items(), [
|
||||
|
@ -357,14 +348,11 @@ run_test('exit button on pill', () => {
|
|||
const info = set_up();
|
||||
|
||||
const config = info.config;
|
||||
const pill_input = info.pill_input;
|
||||
const items = info.items;
|
||||
const container = info.container;
|
||||
|
||||
const widget = input_pill.create(config);
|
||||
|
||||
pill_input.before = () => {};
|
||||
|
||||
widget.appendValue('blue,red');
|
||||
|
||||
var next_pill_focused = false;
|
||||
|
|
Loading…
Reference in New Issue