mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
free trial: Send users to /upgrade after realm creation.
This commit is contained in:
@@ -25,6 +25,7 @@ run_test('create_ajax_request', () => {
|
||||
const form_success = "#autopay-success";
|
||||
const form_error = "#autopay-error";
|
||||
const form_loading = "#autopay-loading";
|
||||
const zulip_limited_section = "#zulip-limited-section";
|
||||
|
||||
const state = {
|
||||
form_input_section_show: 0,
|
||||
@@ -34,6 +35,8 @@ run_test('create_ajax_request', () => {
|
||||
form_loading_show: 0,
|
||||
form_loading_hide: 0,
|
||||
form_success_show: 0,
|
||||
zulip_limited_section_show: 0,
|
||||
zulip_limited_section_hide: 0,
|
||||
location_reload: 0,
|
||||
pushState: 0,
|
||||
make_indicator: 0,
|
||||
@@ -79,6 +82,14 @@ run_test('create_ajax_request', () => {
|
||||
state.form_loading_hide += 1;
|
||||
};
|
||||
|
||||
$(zulip_limited_section).show = () => {
|
||||
state.zulip_limited_section_show += 1;
|
||||
};
|
||||
|
||||
$(zulip_limited_section).hide = () => {
|
||||
state.zulip_limited_section_hide += 1;
|
||||
};
|
||||
|
||||
$("#autopay-form").serializeArray = () => {
|
||||
return jquery("#autopay-form").serializeArray();
|
||||
};
|
||||
@@ -87,6 +98,8 @@ run_test('create_ajax_request', () => {
|
||||
assert.equal(state.form_input_section_hide, 1);
|
||||
assert.equal(state.form_error_hide, 1);
|
||||
assert.equal(state.form_loading_show, 1);
|
||||
assert.equal(state.zulip_limited_section_hide, 1);
|
||||
assert.equal(state.zulip_limited_section_show, 0);
|
||||
assert.equal(state.make_indicator, 1);
|
||||
|
||||
assert.equal(url, "/json/billing/upgrade");
|
||||
@@ -119,12 +132,15 @@ run_test('create_ajax_request', () => {
|
||||
assert.equal(state.form_success_show, 1);
|
||||
assert.equal(state.form_error_hide, 2);
|
||||
assert.equal(state.form_loading_hide, 1);
|
||||
assert.equal(state.zulip_limited_section_hide, 1);
|
||||
assert.equal(state.zulip_limited_section_show, 0);
|
||||
|
||||
error({responseText: '{"msg": "response_message"}'});
|
||||
|
||||
assert.equal(state.form_loading_hide, 2);
|
||||
assert.equal(state.form_error_show, 1);
|
||||
assert.equal(state.form_input_section_show, 1);
|
||||
assert.equal(state.zulip_limited_section_hide, 1);
|
||||
};
|
||||
|
||||
helpers.create_ajax_request("/json/billing/upgrade", "autopay", {id: "stripe_token_id"}, ["licenses"]);
|
||||
|
||||
@@ -102,6 +102,7 @@ run_test("initialize", () => {
|
||||
helpers.is_valid_input = () => {
|
||||
return true;
|
||||
};
|
||||
|
||||
add_card_click_handler(e);
|
||||
invoice_click_handler(e);
|
||||
|
||||
@@ -159,6 +160,8 @@ run_test("autopay_form_fields", () => {
|
||||
assert(document.querySelector("#autopay_loading_indicator"));
|
||||
|
||||
assert(document.querySelector("input[name=csrfmiddlewaretoken]"));
|
||||
|
||||
assert(document.querySelector("#zulip-limited-section"));
|
||||
});
|
||||
|
||||
run_test("invoice_form_fields", () => {
|
||||
@@ -178,4 +181,6 @@ run_test("invoice_form_fields", () => {
|
||||
assert(document.querySelector("#invoice_loading_indicator"));
|
||||
|
||||
assert(document.querySelector("input[name=csrfmiddlewaretoken]"));
|
||||
|
||||
assert(document.querySelector("#zulip-limited-section"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user