From 0e52a59917406ad03c174e030c6c1c92ab23449d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 30 Oct 2023 12:44:11 +0100
Subject: refactor(components): extract SettingsForm component form
 SettingsModal

We could use an array of items and map over it instead of repeating the
Switch component for each settings but with translations, it becomes
quickly unreadable. So I prefer to keep separate components.
---
 .../prism-theme-toggle/prism-theme-toggle.test.tsx | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 src/components/organisms/forms/settings-form/prism-theme-toggle/prism-theme-toggle.test.tsx

(limited to 'src/components/organisms/forms/settings-form/prism-theme-toggle/prism-theme-toggle.test.tsx')

diff --git a/src/components/organisms/forms/settings-form/prism-theme-toggle/prism-theme-toggle.test.tsx b/src/components/organisms/forms/settings-form/prism-theme-toggle/prism-theme-toggle.test.tsx
new file mode 100644
index 0000000..b9f05c4
--- /dev/null
+++ b/src/components/organisms/forms/settings-form/prism-theme-toggle/prism-theme-toggle.test.tsx
@@ -0,0 +1,27 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '../../../../../../tests/utils';
+import { PrismThemeProvider } from '../../../../../utils/providers';
+import { PrismThemeToggle } from './prism-theme-toggle';
+
+describe('PrismThemeToggle', () => {
+  it('renders a radio group of two radio buttons', () => {
+    const defaultTheme = 'dark';
+
+    render(
+      <PrismThemeProvider
+        attribute="fuga"
+        storageKey="sed"
+        defaultTheme={defaultTheme}
+      >
+        <PrismThemeToggle />
+      </PrismThemeProvider>
+    );
+
+    expect(
+      rtlScreen.getByRole('radiogroup', {
+        name: /Code blocks:/i,
+      })
+    ).toBeInTheDocument();
+    expect(rtlScreen.getAllByRole('radio')).toHaveLength(2);
+  });
+});
-- 
cgit v1.2.3

