+
);
}
diff --git a/docs/src/components/ButtonList.tsx b/docs/src/components/ButtonList.tsx
index ef87d281..5b02fc34 100644
--- a/docs/src/components/ButtonList.tsx
+++ b/docs/src/components/ButtonList.tsx
@@ -15,10 +15,10 @@ export function ButtonList() {
"desktop:w-[490px]",
])}
>
-
-
-
-
+
+
+
+
);
}
diff --git a/docs/src/components/IntroText.tsx b/docs/src/components/IntroText.tsx
index ea04f28d..73cb267c 100644
--- a/docs/src/components/IntroText.tsx
+++ b/docs/src/components/IntroText.tsx
@@ -32,7 +32,7 @@ export function IntroText() {
lensable
and like a filesystem
-
+
Date: Tue, 3 Oct 2023 10:21:36 -0400
Subject: [PATCH 03/11] Gradle is not a supported language type.
---
docs/src/pages/jvm/get-started.mdx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/docs/src/pages/jvm/get-started.mdx b/docs/src/pages/jvm/get-started.mdx
index a81b7647..dbb34eca 100644
--- a/docs/src/pages/jvm/get-started.mdx
+++ b/docs/src/pages/jvm/get-started.mdx
@@ -21,7 +21,7 @@ Replace `LATEST_VERSION` with the latest available version of Selfie.
For Gradle users, add this to your `build.gradle` file:
-```gradle
+```bash
testImplementation 'com.yourdomain.selfie:selfie:LATEST_VERSION'
```
@@ -74,7 +74,6 @@ Again, replace `LATEST_VERSION` with the latest available version of Selfie.
## Tips and tricks
- **Folder Structure**: By default, Selfie saves snapshots in a directory named `__snapshots__` alongside your test files. Ensure you check this into your version control to keep reference snapshots consistent across different environments.
-
- **Named Snapshots**: You can name your snapshots to make it easier to identify them, especially if you have multiple snapshots in one test class.
## Contribute
@@ -83,4 +82,4 @@ Selfie is open source and we welcome contributions! Check out the project on [Gi
---
-We hope this guide has helped you get started with Selfie. Enjoy seamless snapshot testing in Java!
\ No newline at end of file
+We hope this guide has helped you get started with Selfie. Enjoy seamless snapshot testing in Java!
From f2fc5728219e8af590ca8f9c387f656bd9436076 Mon Sep 17 00:00:00 2001
From: toddriley
Date: Tue, 3 Oct 2023 16:59:41 -0400
Subject: [PATCH 04/11] Separate Link component from Button component.
---
docs/src/components/Button.tsx | 15 ++++++---------
docs/src/components/ButtonList.tsx | 25 ++++++++++++++++++++----
docs/src/components/IntroText.tsx | 31 +++++++++++++++---------------
3 files changed, 42 insertions(+), 29 deletions(-)
diff --git a/docs/src/components/Button.tsx b/docs/src/components/Button.tsx
index dcb5f5c7..873232c1 100644
--- a/docs/src/components/Button.tsx
+++ b/docs/src/components/Button.tsx
@@ -1,22 +1,19 @@
import clsx from "clsx";
-import Link from "next/link";
+import { ReactNode } from "react";
type ButtonProps = {
- href: string;
- text: string;
+ children: ReactNode;
isDepressed?: boolean;
isWide?: boolean;
};
export function Button({
- href,
- text,
+ children,
isDepressed = false,
isWide = false,
}: ButtonProps) {
return (
-
- {text}
-
+ {children}
+
);
}
diff --git a/docs/src/components/ButtonList.tsx b/docs/src/components/ButtonList.tsx
index 5b02fc34..0cec1339 100644
--- a/docs/src/components/ButtonList.tsx
+++ b/docs/src/components/ButtonList.tsx
@@ -1,7 +1,12 @@
import clsx from "clsx";
+import Link from "next/link";
import { Button } from "./Button";
+import { useRouter } from "next/dist/client/router";
+import { languageFromPath } from "@/lib/languageFromPath";
export function ButtonList() {
+ const router = useRouter();
+ const selectedLanguage = languageFromPath(router.pathname);
return (
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/docs/src/components/IntroText.tsx b/docs/src/components/IntroText.tsx
index 73cb267c..83c187b2 100644
--- a/docs/src/components/IntroText.tsx
+++ b/docs/src/components/IntroText.tsx
@@ -1,5 +1,6 @@
import clsx from "clsx";
import { Button } from "./Button";
+import Link from "next/link";
export function IntroText() {
return (
@@ -28,11 +29,21 @@ export function IntroText() {
])}
>
Which is {" "}
- literal,{" "}
- lensable
- and like a filesystem
+
+ literal
+
+ ,{" "}
+
+ lensable
+
+ and{" "}
+
+ like a filesystem
+
-
+
+
+
diff --git a/docs/src/pages/index.mdx b/docs/src/pages/index.mdx
index f840e357..c3157a0a 100644
--- a/docs/src/pages/index.mdx
+++ b/docs/src/pages/index.mdx
@@ -1,7 +1,8 @@
import { Hero } from "@/components/Hero";
import { Selfie } from "@/components/Selfie";
-
+{/* show the homepage hero component and hide the navigation used everywhere else in the app */}
+export const showHero = true
## is literal
diff --git a/docs/src/pages/js/index.mdx b/docs/src/pages/js/index.mdx
index 4f7b08d1..d5b5e9b0 100644
--- a/docs/src/pages/js/index.mdx
+++ b/docs/src/pages/js/index.mdx
@@ -1,14 +1,21 @@
-## selfie is literal
+import { Selfie } from "@/components/Selfie";
+
+## is literal
Sure, you could write your assertions like this.
```javascript
-describe('login', () => {
- it('should set the login cookie', () => {
- const response = request.post('/confirm/login/erjchFbCXxMlUfFXx3oYiO-Rj6zM7tRGdRV8ziqRn5Jh', {
- followRedirect: false
- });
- expect(response.cookies.login).toBe("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiZGlmZnBsdWcuY29tIiwiYXVkIjoiZGlmZnBsdWcuY29tIiwiaWF0IjoxNTc3NjY0MDAsImVtYWlsIjoibHVrZS5za3l3YWxrZXJAZGlmZnBsdWcuY29tIiwic2FsZXMiOiJ0cnVlIn0.v7nes7_rTa0NiwTz6OLIAmRZJ-XzzGULRiAPWBiV5iI");
+describe("login", () => {
+ it("should set the login cookie", () => {
+ const response = request.post(
+ "/confirm/login/erjchFbCXxMlUfFXx3oYiO-Rj6zM7tRGdRV8ziqRn5Jh",
+ {
+ followRedirect: false,
+ }
+ );
+ expect(response.cookies.login).toBe(
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiZGlmZnBsdWcuY29tIiwiYXVkIjoiZGlmZnBsdWcuY29tIiwiaWF0IjoxNTc3NjY0MDAsImVtYWlsIjoibHVrZS5za3l3YWxrZXJAZGlmZnBsdWcuY29tIiwic2FsZXMiOiJ0cnVlIn0.v7nes7_rTa0NiwTz6OLIAmRZJ-XzzGULRiAPWBiV5iI"
+ );
});
});
```
@@ -16,11 +23,14 @@ describe('login', () => {
But isn't this easier to read? And also more complete?
```javascript
-describe('login', () => {
- it('should match expected headers', () => {
- const response = request.post('/confirm/login/erjchFbCXxMlUfFXx3oYiO-Rj6zM7tRGdRV8ziqRn5Jh', {
- followRedirect: false
- });
+describe("login", () => {
+ it("should match expected headers", () => {
+ const response = request.post(
+ "/confirm/login/erjchFbCXxMlUfFXx3oYiO-Rj6zM7tRGdRV8ziqRn5Jh",
+ {
+ followRedirect: false,
+ }
+ );
expectSelfie(response.headers).toBe(`
content-type=text/plain
...
@@ -32,25 +42,25 @@ describe('login', () => {
... And so on ...
-## selfie is lensable
+## is lensable
Some snapshots are so big that it would be cumbersome to put them inline into your test code. So selfie helps you put them on disk.
```javascript
-describe('gzipFavicon', () => {
- it('should match the disk content', () => {
- const response = request.get('/favicon.ico', { encoding: 'gzip' });
+describe("gzipFavicon", () => {
+ it("should match the disk content", () => {
+ const response = request.get("/favicon.ico", { encoding: "gzip" });
expectSelfie(response).toMatchDisk();
});
});
-describe('orderFlow', () => {
- it('should match the disk content', () => {
- let response = request.get('/orders');
- expectSelfie(response).toMatchDisk('initial');
+describe("orderFlow", () => {
+ it("should match the disk content", () => {
+ let response = request.get("/orders");
+ expectSelfie(response).toMatchDisk("initial");
postOrder();
- response = request.get('/orders');
- expectSelfie(response).toMatchDisk('ordered');
+ response = request.get("/orders");
+ expectSelfie(response).toMatchDisk("ordered");
});
});
```
From 6453b107b9bc07fece231ab042def7faf593acfe Mon Sep 17 00:00:00 2001
From: toddriley
Date: Tue, 3 Oct 2023 19:23:58 -0400
Subject: [PATCH 08/11] Use selfie logo in headings.
---
docs/src/pages/jvm/index.mdx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/src/pages/jvm/index.mdx b/docs/src/pages/jvm/index.mdx
index d9a2a613..b95e48fc 100644
--- a/docs/src/pages/jvm/index.mdx
+++ b/docs/src/pages/jvm/index.mdx
@@ -1,4 +1,6 @@
-## selfie is literal
+import { Selfie } from "@/components/Selfie";
+
+## is literal
Sure, you could write your assertions like this.
@@ -55,7 +57,7 @@ public void preventCssBloat() {
}
```
-## selfie is lensable
+## is lensable
Some snapshots are so big that it would be cumbersome to put them inline into your test code. So selfie helps you put them on disk.
@@ -91,8 +93,8 @@ H4sIAAAAAAAA/8pIzcnJVyjPL8pJUQQAlQYXAAAA
TODO.
-## selfie is like a filesystem
+## is like a filesystem
Selfie's snapshot files `.ss` are incredibly simple to parse, and you can use `selfie-lib` to parse them for you if you want. You can treat them as an output deliverable of your code, and use them as an input to other tooling.
-
-TODO.
\ No newline at end of file
+
+TODO.
From cec03f6a0ebdb77c37a433469875df889962808c Mon Sep 17 00:00:00 2001
From: toddriley
Date: Tue, 3 Oct 2023 19:32:25 -0400
Subject: [PATCH 09/11] Style the language selector.
---
.../components/Navigation/LanguageSelect.tsx | 57 +++++++++++++++----
docs/src/components/Navigation/Navigation.tsx | 6 +-
2 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/docs/src/components/Navigation/LanguageSelect.tsx b/docs/src/components/Navigation/LanguageSelect.tsx
index 4436dd86..699c48d6 100644
--- a/docs/src/components/Navigation/LanguageSelect.tsx
+++ b/docs/src/components/Navigation/LanguageSelect.tsx
@@ -1,7 +1,6 @@
import { LanguageSlug, languageSlugsToLabels } from "@/lib/languageFromPath";
import { Listbox } from "@headlessui/react";
import clsx from "clsx";
-import { Dispatch, SetStateAction } from "react";
import { Button } from "../Button";
import { CaretBottom } from "../Icons/CaretBottom";
@@ -18,16 +17,54 @@ export function LanguageSelect({