Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
sponsorship: Ensure that all the fields are filled in form.
Vishnu KSe736bc3ec6a8
diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.jsindex bd76dbcf4dd..9b8a8bc9045 100644--- a/frontend_tests/node_tests/upgrade.js+++ b/frontend_tests/node_tests/upgrade.js@@ -37,7 +37,9 @@ run_test("initialize", () => {assert.equal(page_name, "upgrade");};+ let create_ajax_request_form_call_count = 0;helpers.create_ajax_request = (url, form_name, stripe_token, numeric_inputs, redirect_to) => {+ create_ajax_request_form_call_count += 1;if (form_name === "autopay") {assert.equal(url, "/json/billing/upgrade");assert.equal(stripe_token, "stripe_add_card_token");@@ -111,15 +113,18 @@ run_test("initialize", () => {const request_sponsorship_click_handler = $("#sponsorship-button").get_on_handler("click");helpers.is_valid_input = () => true;-add_card_click_handler(e);+ assert.equal(create_ajax_request_form_call_count, 1);invoice_click_handler(e);+ assert.equal(create_ajax_request_form_call_count, 2);+ request_sponsorship_click_handler(e);+ assert.equal(create_ajax_request_form_call_count, 3);helpers.is_valid_input = () => false;add_card_click_handler(e);invoice_click_handler(e);-request_sponsorship_click_handler(e);+ assert.equal(create_ajax_request_form_call_count, 3);helpers.show_license_section = (section) => {assert.equal(section, "manual");diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.jsindex 9a1672cd5f0..cb4f7cc4fc3 100644--- a/static/js/billing/upgrade.js+++ b/static/js/billing/upgrade.js@@ -40,6 +40,9 @@ exports.initialize = () => {});$("#sponsorship-button").on("click", (e) => {+ if (!helpers.is_valid_input($("#sponsorship-form"))) {+ return;+ }e.preventDefault();helpers.create_ajax_request("/json/billing/sponsorship",diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.htmlindex b9b5cccf94b..6e2907ab3ce 100644--- a/templates/corporate/upgrade.html+++ b/templates/corporate/upgrade.html@@ -223,8 +223,8 @@<label><h4>Organization type</h4></label>- <select name="organization-type" required style="width: 100%;">- <option disabled selected> -- select --</option>+ <select name="organization-type" required style="width: 100%;" required>+ <option disabled selected value=""> -- select --</option><option value="open_source">{{_('Open source')}}</option><option value="research">{{_('Academic research')}}</option><option value="education">{{_('Education')}}</option>