Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe("MovieFormClient integration", () => {
}
);

fireEvent.click(screen.getByRole("button", { name: "Get Movie" }));
fireEvent.click(screen.getByRole("button", { name: "Get Movies" }));

await waitFor(() => {
expect(mockPush).toHaveBeenCalledWith("/recommendations");
Expand Down
6 changes: 3 additions & 3 deletions app/(routes)/movieForm/MovieFormClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MovieFormClient = () => {

return (
<>
<h2 className="text-2xl mb-4 text-center">Person #{currentParticipant}</h2>
<h1 className="text-2xl mb-4 text-center">Person #{currentParticipant}</h1>
<form onSubmit={handleFormSubmission} className="space-y-6">
<MovieFormFields
formData={formData}
Expand All @@ -67,8 +67,8 @@ const MovieFormClient = () => {
handleTypeChange={handleTypeChange}
/>

<button type="submit" className="btn btn-primary block w-full text-3xl">
{currentParticipant === totalParticipants ? "Get Movie" : "Next"}
<button type="submit" className="btn btn-primary block w-full text-3xl font-display">
{currentParticipant === totalParticipants ? "Get Movies" : "Next"}
</button>

{error && <p className="text-red-500 text-center">{error}</p>}
Expand Down
6 changes: 3 additions & 3 deletions app/(routes)/movieForm/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ describe("MovieForm", () => {
it("renders the form with initial state", () => {
renderMovieForm();
expect(screen.getByText("Person #1")).toBeInTheDocument();
expect(screen.getByRole("button", { name: /get movie/i })).toBeInTheDocument();
expect(screen.getByRole("button", { name: /get movies/i })).toBeInTheDocument();
});

it("returns a validation error message when required fields are empty", async () => {
renderMovieForm();

const submitBtn = screen.getByRole("button", { name: /get movie/i });
const submitBtn = screen.getByRole("button", { name: /get movies/i });
fireEvent.click(submitBtn);

expect(await screen.findByText("Please fill out all required fields")).toBeInTheDocument();
Expand All @@ -60,7 +60,7 @@ describe("MovieForm", () => {
fireEvent.change(movieInput, { target: { value: "The Matrix" } });
fireEvent.change(personInput, { target: { value: "Keanu Reeves" } });

const submitBtn = screen.getByRole("button", { name: /get movie/i });
const submitBtn = screen.getByRole("button", { name: /get movies/i });
fireEvent.click(submitBtn);

await waitFor(() => {
Expand Down
Binary file modified app/favicon.ico
Binary file not shown.
23 changes: 12 additions & 11 deletions app/fonts.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { Carter_One, Roboto_Slab } from "next/font/google";
import { Syne, Inter } from "next/font/google";

const carterOneInit = Carter_One({
weight: "400",
const syneInit = Syne({
weight: ["800"],
subsets: ["latin"],
variable: "--ff-serif",
fallback: ["serif"],
variable: "--ff-display",
display: "swap",
fallback: ["system-ui", "sans-serif"],
preload: true,
adjustFontFallback: false,
});
const robotoSlabInit = Roboto_Slab({
weight: ["300", "400", "700"],
display: "swap",

const interInit = Inter({
weight: ["500"],
subsets: ["latin"],
variable: "--ff-sans-serif",
fallback: ["sans-serif"],
display: "swap",
preload: true,
adjustFontFallback: false,
});

export const carterOne = carterOneInit.variable;
export const robotoSlab = robotoSlabInit.variable;
export const syne = syneInit.variable;
export const inter = interInit.variable;
4 changes: 3 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
body {
color: var(--foreground, #ffffff);
font-family: var(--ff-sans-serif, Arial, Helvetica, sans-serif);
line-height: 1.6;
}

h1 {
font-family: var(--ff-serif, Arial, Helvetica, sans-serif);
font-family: var(--ff-display, Arial, Helvetica, sans-serif);
letter-spacing: -0.02em;
}
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata } from "next";
import "./globals.css";
import { carterOne, robotoSlab } from "./fonts";
import { syne, inter } from "./fonts";
import { MovieProvider } from "@/contexts/MovieContext";
import Header from "@/components/features/Header";
import { Globe, Mail } from "lucide-react";
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function RootLayout({
return (
<html lang={SITE_LANGUAGE}>
<body
className={`${carterOne} ${robotoSlab} antialiased bg-base-100 min-h-screen flex flex-col justify-center items-center py-4`}
className={`${syne} ${inter} antialiased bg-base-100 min-h-screen flex flex-col justify-center items-center py-4`}
>
<MovieProvider>
<Header />
Expand Down
6 changes: 3 additions & 3 deletions components/features/Logo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jest.mock("next/image", () => ({
}));

// Mock the image import
jest.mock("@/public/popcorn.png", () => ({
src: "/mocked-popcorn.png",
jest.mock("@/public/film.png", () => ({
src: "/mocked-film.png",
height: 100,
width: 100,
}));
Expand Down Expand Up @@ -46,7 +46,7 @@ describe("Logo Component", () => {
const { container } = render(<Logo />);
const image = container.querySelector("img");

expect(image).toHaveAttribute("alt", "Popcorn");
expect(image).toHaveAttribute("alt", "App logo representing a film");
});

// Test cleanup after each test
Expand Down
12 changes: 10 additions & 2 deletions components/features/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
"use client";

import Image from "next/image";
import popcorn from "@/public/popcorn.png";
import film from "@/public/film.png";
import { usePathname } from "next/navigation";

const Logo = () => {
const pathname = usePathname();
if (pathname === "/recommendations") return null;
return <Image src={popcorn} alt="Popcorn" className="mx-auto" />;
return (
<Image
src={film}
width={99}
alt="App logo representing a film"
className="mx-auto h-auto"
loading="eager"
/>
);
};

export default Logo;
5 changes: 4 additions & 1 deletion components/features/ParticipantsSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ const ParticipantsSetup = () => {
/>
</div>

<button onClick={handleStart} className="btn btn-primary block mx-auto w-full text-3xl">
<button
onClick={handleStart}
className="btn btn-primary block mx-auto w-full text-3xl font-display"
>
Start
</button>
</div>
Expand Down
Binary file added public/film.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/popcorn.png
Binary file not shown.
3 changes: 3 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export default {
background: "var(--background)",
foreground: "var(--foreground)",
},
fontFamily: {
display: ["var(--ff-display)", "system-ui", "sans-serif"],
},
},
},
plugins: [daisyui],
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/guard-and-validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test.describe("Recommendation guardrails", () => {

await expect(page).toHaveURL(/\/movieForm$/);

await page.getByRole("button", { name: "Get Movie" }).click();
await page.getByRole("button", { name: "Get Movies" }).click();

await expect(page.getByText("Please fill out all required fields")).toBeVisible();
await expect(page.getByText("This field is required")).toHaveCount(2);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test.describe("Core recommendation journey", () => {

const recommendationsRequest = page.waitForRequest("**/api/recommendations");
const recommendationsResponse = page.waitForResponse("**/api/recommendations");
await page.getByRole("button", { name: "Get Movie" }).click();
await page.getByRole("button", { name: "Get Movies" }).click();

await expect(page).toHaveURL(/\/recommendations$/);
await recommendationsRequest;
Expand Down
Loading