From 9cbef657ac9484cbf79234527ec6bfe6a451ece8 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Sat, 9 Apr 2022 19:16:30 +0200
Subject: refactor(toggle): use Checkbox component and move it to molecules

---
 src/components/molecules/forms/toggle.test.tsx | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 src/components/molecules/forms/toggle.test.tsx

(limited to 'src/components/molecules/forms/toggle.test.tsx')

diff --git a/src/components/molecules/forms/toggle.test.tsx b/src/components/molecules/forms/toggle.test.tsx
new file mode 100644
index 0000000..fb97adc
--- /dev/null
+++ b/src/components/molecules/forms/toggle.test.tsx
@@ -0,0 +1,29 @@
+import { render, screen } from '@test-utils';
+import Toggle from './toggle';
+
+const choices = {
+  left: 'On',
+  right: 'Off',
+};
+
+const label = 'Activate this setting:';
+
+describe('Toggle', () => {
+  it('renders a checked toggle', () => {
+    render(
+      <Toggle
+        id="toggle-example"
+        name="toggle-example"
+        choices={choices}
+        label={label}
+        value={true}
+        setValue={(__value) => null}
+      />
+    );
+    expect(
+      screen.getByRole('checkbox', {
+        name: `${label} ${choices.left} ${choices.right}`,
+      })
+    ).toBeChecked();
+  });
+});
-- 
cgit v1.2.3

