From a4a406463d69f6901919d273e831dff22a838caf Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 19 Apr 2022 12:07:21 +0200
Subject: chore: add a Gallery component

---
 src/components/organisms/images/gallery.test.tsx | 38 ++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 src/components/organisms/images/gallery.test.tsx

(limited to 'src/components/organisms/images/gallery.test.tsx')

diff --git a/src/components/organisms/images/gallery.test.tsx b/src/components/organisms/images/gallery.test.tsx
new file mode 100644
index 0000000..5f35f0a
--- /dev/null
+++ b/src/components/organisms/images/gallery.test.tsx
@@ -0,0 +1,38 @@
+import ResponsiveImage from '@components/molecules/images/responsive-image';
+import { render, screen } from '@test-utils';
+import Gallery from './gallery';
+
+const columns = 3;
+
+const image = {
+  alt: 'Modi provident omnis',
+  height: 480,
+  src: 'http://placeimg.com/640/480/fashion',
+  width: 640,
+};
+
+describe('Gallery', () => {
+  it('renders the correct number of items', () => {
+    render(
+      <Gallery columns={columns}>
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+      </Gallery>
+    );
+    expect(screen.getAllByRole('listitem')).toHaveLength(4);
+  });
+
+  it('renders the right number of columns', () => {
+    render(
+      <Gallery columns={columns}>
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+        <ResponsiveImage {...image} />
+      </Gallery>
+    );
+    expect(screen.getByRole('list')).toHaveClass(`wrapper--${columns}-columns`);
+  });
+});
-- 
cgit v1.2.3

