compose tests: Avoid global `event` var.

It's better to be explicit here and avoid leaking
between tests.
This commit is contained in:
Steve Howell 2019-02-02 14:48:30 +00:00 committed by showell
parent 8e88ca3a46
commit 6116ede5f7
1 changed files with 17 additions and 4 deletions

View File

@ -1330,10 +1330,6 @@ run_test('on_events', () => {
assert(!$("#compose-send-status").visible());
}());
var event = {
preventDefault: noop,
};
(function test_stream_name_completed_triggered() {
var handler = $(document).get_on_handler('streamname_completed.zulip');
stream_data.add_sub(compose_state.stream_name(), {
@ -1410,6 +1406,11 @@ run_test('on_events', () => {
assert.equal(ev_name, 'click');
compose_file_input_clicked = true;
};
var event = {
preventDefault: noop,
};
handler(event);
assert(compose_file_input_clicked);
}());
@ -1428,6 +1429,10 @@ run_test('on_events', () => {
var handler = $("#compose").get_on_handler("click", "#video_link");
$('#compose-textarea').val('');
var event = {
preventDefault: noop,
};
handler(event);
// video link ids consist of 15 random digits
@ -1541,6 +1546,10 @@ run_test('on_events', () => {
$("#compose-textarea").val('');
setup_visibilities();
var event = {
preventDefault: noop,
};
handler(event);
assert.equal($("#preview_content").html(),
@ -1592,6 +1601,10 @@ run_test('on_events', () => {
$("#preview_message_area").show();
$("#markdown_preview").hide();
var event = {
preventDefault: noop,
};
handler(event);
assert($("#compose-textarea").visible());