feat(home): seção Sobre com prova por ponto, contato por oferta e hero com a Lavação 047 na tela larga
This commit is contained in:
1 parent
d356c364e0
commit
9fd1570426
33 files changed
+1128
-369
No files matched your search
@@ -1,7 +1,12 @@
|
||||
import { serviceOffers } from "@/lib/site-content";
|
||||
import { OFFER_SUBJECTS } from "@/lib/whatsapp";
|
||||
import {
|
||||
CONTACT_FORM_HASH,
|
||||
CONTACT_FORM_ID,
|
||||
CONTACT_KIND_PARAM,
|
||||
CONTACT_KINDS,
|
||||
CONTACT_SUBJECT_OPTIONS,
|
||||
contactKindForSubject,
|
||||
contactKindHref,
|
||||
contactSubjectForKind,
|
||||
DEFAULT_CONTACT_SUBJECT,
|
||||
@@ -18,16 +23,45 @@ describe("contact-subject", () => {
|
||||
expect(CONTACT_SUBJECT_OPTIONS).toContain(subject);
|
||||
}
|
||||
expect(CONTACT_KINDS).toEqual({
|
||||
site: "Site para empresa",
|
||||
sistema: "Sistemas web sob medida",
|
||||
revisao: "Revisão ou diagnóstico de sistema",
|
||||
site: "Site que traz pedidos pelo WhatsApp",
|
||||
sistema: "Sistema para tirar a operação da planilha",
|
||||
revisao: "Revisão de sistema que já existe",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the name of each offer, the same one of serviceOffers (lib/site-content.ts), and the same WhatsApp phrase", () => {
|
||||
expect(serviceOffers.map(({ id }) => id)).toEqual(
|
||||
Object.keys(CONTACT_KINDS),
|
||||
);
|
||||
for (const offer of serviceOffers) {
|
||||
expect(CONTACT_KINDS[offer.id]).toBe(offer.name);
|
||||
expect(OFFER_SUBJECTS[offer.id]).toBe(offer.whatsappSubject);
|
||||
// a frase entra em "Quero conversar sobre {assunto}.": começa em minúscula e não termina em ponto
|
||||
expect(OFFER_SUBJECTS[offer.id]).toMatch(/^[a-zà-ú].*[^.]$/);
|
||||
}
|
||||
});
|
||||
|
||||
it("finds the offer of an option of the form, and none for the other options", () => {
|
||||
expect(contactKindForSubject(CONTACT_KINDS.site)).toBe("site");
|
||||
expect(contactKindForSubject(CONTACT_KINDS.revisao)).toBe("revisao");
|
||||
for (const other of [
|
||||
DEFAULT_CONTACT_SUBJECT,
|
||||
"Aplicativos",
|
||||
"",
|
||||
"constructor",
|
||||
null,
|
||||
undefined,
|
||||
]) {
|
||||
expect(contactKindForSubject(other)).toBeUndefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("looks a type up by its own keys only", () => {
|
||||
expect(contactSubjectForKind("site")).toBe("Site para empresa");
|
||||
expect(contactSubjectForKind("site")).toBe(
|
||||
"Site que traz pedidos pelo WhatsApp",
|
||||
);
|
||||
expect(contactSubjectForKind("revisao")).toBe(
|
||||
"Revisão ou diagnóstico de sistema",
|
||||
"Revisão de sistema que já existe",
|
||||
);
|
||||
for (const unknown of [
|
||||
"",
|
||||
@@ -42,15 +76,17 @@ describe("contact-subject", () => {
|
||||
expect(contactSubjectForKind(undefined)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("builds the address with the type in the search, before the fragment, so #contact still finds the section", () => {
|
||||
it("builds the address with the type in the search, before the fragment, so #contact-form still finds the form card", () => {
|
||||
expect(CONTACT_FORM_ID).toBe("contact-form");
|
||||
expect(contactKindHref("site")).toBe(
|
||||
`/?${CONTACT_KIND_PARAM}=site#contact`,
|
||||
`/?${CONTACT_KIND_PARAM}=site${CONTACT_FORM_HASH}`,
|
||||
);
|
||||
expect(contactKindHref("site")).toBe("/?tipo=site#contact-form");
|
||||
for (const kind of Object.keys(CONTACT_KINDS) as Array<
|
||||
keyof typeof CONTACT_KINDS
|
||||
>) {
|
||||
const url = new URL(contactKindHref(kind), "https://example.com");
|
||||
expect(url.hash).toBe("#contact");
|
||||
expect(url.hash).toBe("#contact-form");
|
||||
expect(url.searchParams.get("tipo")).toBe(kind);
|
||||
expect(url.pathname).toBe("/");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user