diff --git a/tests/www/navigate_test.ts b/tests/www/navigate_test.ts new file mode 100644 index 00000000..e2852094 --- /dev/null +++ b/tests/www/navigate_test.ts @@ -0,0 +1,12 @@ +import { waitForText, withPageName } from "$fresh/tests/test_utils.ts"; + +Deno.test("www - docs navigation", async () => { + await withPageName("./www/main.ts", async (page, address) => { + await page.goto(`${address}`, { waitUntil: "networkidle2" }); + await page.click(`a[href="/docs"]`); + await waitForText(page, "h1", "Introduction"); + + await page.click(`a[href="/docs/getting-started/create-a-project"]`); + await waitForText(page, "h1", "Create a project"); + }); +}); diff --git a/www/components/DocsSidebar.tsx b/www/components/DocsSidebar.tsx index 69c05d4c..1b401a80 100644 --- a/www/components/DocsSidebar.tsx +++ b/www/components/DocsSidebar.tsx @@ -8,7 +8,6 @@ import VersionSelect from "../islands/VersionSelect.tsx"; import { type VersionLink } from "../routes/docs/[...slug].tsx"; import { Logo } from "$fresh/www/components/Header.tsx"; import DocsTitle from "$fresh/www/components/DocsTitle.tsx"; -import docsearch from "https://esm.sh/@docsearch/js@3?target=es2020"; export default function DocsSidebar( props: { @@ -28,7 +27,7 @@ export default function DocsSidebar(
- +
void; class?: string }, + props: { docsearch?: (args: DocSearchProps) => void; class?: string }, ) { const ref = useRef(null); useEffect(() => { if (ref.current) { - props.docsearch({ + props.docsearch || docsearch({ appId: "CWUS37S0PK", apiKey: "caa591b6dcb2c9308551361d954a728b", indexName: "fresh",