From 1600529a8b766414f066abb08e068f423f147f83 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 26 Aug 2018 11:40:22 +0000 Subject: [PATCH] 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. --- frontend_tests/node_tests/input_pill.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index 498419861d..1efa39b5bc 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -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;