Walk Create Community through the Figma screens and restore a chosen logo after reload, so a guest can leave without saving until they reach the email step.
This commit is contained in:
1 parent
ca1f58a50c
commit
2348a9e94f
61 files changed
+1110
-421
No files matched your search
@@ -1,7 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import communitySize from "../../messages/en/create/community/communitySize.json";
|
||||
import { SIZE_BANDS } from "../../lib/create/deckTypes";
|
||||
import { isCommunitySizeStepBlocked } from "../../app/(app)/create/utils/createFlowFooterLabels";
|
||||
import {
|
||||
isCommunityNameStepBlocked,
|
||||
isCommunitySizeStepBlocked,
|
||||
isCommunityStructureStepBlocked,
|
||||
} from "../../app/(app)/create/utils/createFlowFooterLabels";
|
||||
|
||||
/**
|
||||
* Inclusive bounds. 100 stays in 13 to 100. More than 100 starts at 101.
|
||||
@@ -64,3 +68,37 @@ describe("community size bands", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("community name and type continue gates", () => {
|
||||
it("blocks the name step until a title is entered", () => {
|
||||
expect(isCommunityNameStepBlocked("community-name", undefined)).toBe(true);
|
||||
expect(isCommunityNameStepBlocked("community-name", " ")).toBe(true);
|
||||
expect(isCommunityNameStepBlocked("community-name", "Garden Club")).toBe(
|
||||
false,
|
||||
);
|
||||
expect(isCommunityNameStepBlocked("community-size", "")).toBe(false);
|
||||
});
|
||||
|
||||
it("blocks the type step until a main kind and a maturity are chosen", () => {
|
||||
expect(
|
||||
isCommunityStructureStepBlocked("community-structure", [], ["earlyStage"]),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isCommunityStructureStepBlocked(
|
||||
"community-structure",
|
||||
["mutualAid"],
|
||||
[],
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isCommunityStructureStepBlocked(
|
||||
"community-structure",
|
||||
["mutualAid"],
|
||||
["established"],
|
||||
),
|
||||
).toBe(false);
|
||||
expect(
|
||||
isCommunityStructureStepBlocked("community-size", [], []),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -17,11 +17,14 @@ describe("getProportionBarProgressForCreateFlowStep", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("uses 2-0 on community-save, review, and core-values (Create Community segment / same fill)", () => {
|
||||
expect(getProportionBarProgressForCreateFlowStep("community-save")).toBe(
|
||||
"2-0",
|
||||
it("maps the rest of Create Community onto part 1, skipping setup at 1-5", () => {
|
||||
expect(getProportionBarProgressForCreateFlowStep("community-upload")).toBe(
|
||||
"1-6",
|
||||
);
|
||||
expect(getProportionBarProgressForCreateFlowStep("review")).toBe("2-0");
|
||||
expect(getProportionBarProgressForCreateFlowStep("community-save")).toBe(
|
||||
"1-7",
|
||||
);
|
||||
expect(getProportionBarProgressForCreateFlowStep("review")).toBe("1-8");
|
||||
expect(getProportionBarProgressForCreateFlowStep("core-values")).toBe(
|
||||
"2-0",
|
||||
);
|
||||
|
||||
@@ -25,4 +25,10 @@ describe("create footer messages", () => {
|
||||
"Publish CommunityRule",
|
||||
);
|
||||
});
|
||||
|
||||
it("exposes Skip and Skip for now for optional community steps", () => {
|
||||
expect(messages.create.footer.skip).toBe("Skip");
|
||||
expect(messages.create.footer.skipForNow).toBe("Skip for now");
|
||||
expect(messages.create.footer.submitEmail).toBe("Submit email");
|
||||
});
|
||||
});
|
||||
@@ -175,7 +175,7 @@ describe("flowSteps", () => {
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("parseReviewReturnSearchParam accepts only final-review and edit-rule", () => {
|
||||
it("parseReviewReturnSearchParam accepts final-review, edit-rule, and review", () => {
|
||||
expect(
|
||||
parseReviewReturnSearchParam(
|
||||
new URLSearchParams("reviewReturn=final-review"),
|
||||
@@ -186,16 +186,22 @@ describe("flowSteps", () => {
|
||||
new URLSearchParams("reviewReturn=edit-rule"),
|
||||
),
|
||||
).toBe("edit-rule");
|
||||
expect(
|
||||
parseReviewReturnSearchParam(new URLSearchParams("reviewReturn=review")),
|
||||
).toBe("review");
|
||||
expect(
|
||||
parseReviewReturnSearchParam(new URLSearchParams("reviewReturn=nope")),
|
||||
).toBeNull();
|
||||
expect(parseReviewReturnSearchParam(null)).toBeNull();
|
||||
});
|
||||
|
||||
it("offers Save & Exit from community-structure through final-review and on edit-rule", () => {
|
||||
it("offers Save and exit from community-save through final-review and on edit-rule", () => {
|
||||
expect(shouldOfferCreateFlowSaveAndExit("informational")).toBe(false);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("community-name")).toBe(false);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("community-structure")).toBe(true);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("community-structure")).toBe(false);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("community-upload")).toBe(false);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("community-save")).toBe(true);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("review")).toBe(true);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("final-review")).toBe(true);
|
||||
expect(shouldOfferCreateFlowSaveAndExit("edit-rule")).toBe(true);
|
||||
});
|
||||
|
||||
@@ -18,4 +18,8 @@ describe("isValidCreateFlowSaveEmail", () => {
|
||||
it("accepts a required type=email value", () => {
|
||||
expect(isValidCreateFlowSaveEmail("user@example.com")).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects a domain with no dot", () => {
|
||||
expect(isValidCreateFlowSaveEmail("maya@example")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user