mirror of https://github.com/zulip/zulip.git
sponsorship: Ensure that all the fields are filled in form.
This commit is contained in:
parent
69e0625a09
commit
e736bc3ec6
|
@ -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");
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue