BS-002 Establish public marketing routes and navigation
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
import styles from "./Homepage.module.scss";
|
||||
|
||||
const Homepage = () => {
|
||||
return (
|
||||
<main className={styles.homepage}>
|
||||
<section>
|
||||
<p>Reusable Flask and React application foundation</p>
|
||||
<h1>Build your application from here</h1>
|
||||
<p>
|
||||
Replace this placeholder with the generated project's
|
||||
purpose, primary action, and product-specific content.
|
||||
</p>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
import { Container } from "react-bootstrap";
|
||||
export default function Homepage() {
|
||||
return <Container className="routePlaceholder">
|
||||
<p className="eyebrow">BortStack · Website in development</p>
|
||||
<h1>Software development for real-world needs</h1>
|
||||
<p>The approved BortStack homepage is being prepared.</p>
|
||||
</Container>;
|
||||
}
|
||||
|
||||
export default Homepage
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { fireEvent, render, screen, within } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import App from "../App";
|
||||
|
||||
afterEach(() => { window.history.replaceState({}, "", "/"); vi.unstubAllGlobals(); });
|
||||
describe("public marketing routes", () => {
|
||||
it.each([
|
||||
["/services", "Services"], ["/projects", "Projects"],
|
||||
["/projects/example", "Project details"], ["/about", "About BortStack"],
|
||||
["/contact", "Contact"], ["/privacy", "Privacy policy"],
|
||||
["/login", "Page not found"], ["/register", "Page not found"], ["/dashboard", "Page not found"],
|
||||
])("loads %s without account infrastructure", (path, heading) => {
|
||||
const fetchMock = vi.fn();
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
window.history.replaceState({}, "", path);
|
||||
render(<App />);
|
||||
expect(screen.getByRole("heading", { level: 1, name: heading })).toBeInTheDocument();
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
expect(screen.queryByRole("link", { name: /login|register|dashboard/i })).not.toBeInTheDocument();
|
||||
});
|
||||
it("exposes the four marketing links and closes navigation on selection", async () => {
|
||||
render(<App />);
|
||||
const nav = screen.getByRole("navigation", { name: "Main navigation" });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Toggle navigation" }));
|
||||
await within(nav).findByRole("link", { name: "Services" });
|
||||
for (const name of ["Services", "Projects", "About", "Contact"]) {
|
||||
expect(within(nav).getByRole("link", { name })).toBeInTheDocument();
|
||||
}
|
||||
fireEvent.click(within(nav).getByRole("link", { name: "Services" }));
|
||||
expect(screen.getByRole("button", { name: "Toggle navigation" })).toHaveAttribute("aria-expanded", "false");
|
||||
expect(screen.getByRole("heading", { name: "Services" })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -9,9 +9,9 @@ import Terms from "./Legal/Terms";
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
describe("generic public pages", () => {
|
||||
it("marks homepage content as replaceable", () => {
|
||||
it("shows the marketing homepage shell", () => {
|
||||
render(<MemoryRouter><Homepage /></MemoryRouter>);
|
||||
expect(screen.getByRole("heading", { name: /build your application/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: /software development for real-world needs/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("marks legal pages as placeholders", () => {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import PropTypes from "prop-types";
|
||||
import { Container } from "react-bootstrap";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
export default function RoutePlaceholder({ title, description }) {
|
||||
return <Container className="routePlaceholder">
|
||||
<p className="eyebrow">BortStack · Website in development</p>
|
||||
<h1>{title}</h1>
|
||||
<p>{description}</p>
|
||||
<Link to="/">Back to homepage <span aria-hidden="true">→</span></Link>
|
||||
</Container>;
|
||||
}
|
||||
RoutePlaceholder.propTypes = { title: PropTypes.string.isRequired, description: PropTypes.string.isRequired };
|
||||
Reference in New Issue
Block a user