From c153f93dc8691a71dc76aad3dd618298da9d238a Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 17 Oct 2023 19:46:08 +0200
Subject: refactor(components): rewrite Card component

* make the component more generic
* merge `<Summary />` and `<Comment />` styles into card component
to avoid repeating the same structure
* remove most of the props to use composition

However the CSS is a bit complex because of the two variants...

Also, the component should be refactored when the CSS pseudo-class
`:has` has enough support: the provider and the `cover` and `meta`
props should be removed.
---
 .../molecules/card/card-actions.test.tsx           | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 src/components/molecules/card/card-actions.test.tsx

(limited to 'src/components/molecules/card/card-actions.test.tsx')

diff --git a/src/components/molecules/card/card-actions.test.tsx b/src/components/molecules/card/card-actions.test.tsx
new file mode 100644
index 0000000..94c2677
--- /dev/null
+++ b/src/components/molecules/card/card-actions.test.tsx
@@ -0,0 +1,37 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { CardActions } from './card-actions';
+
+describe('CardActions', () => {
+  it('renders its children', () => {
+    const actions = 'animi et omnis';
+
+    render(<CardActions>{actions}</CardActions>);
+
+    expect(rtlScreen.getByText(actions)).toBeInTheDocument();
+  });
+
+  it('can render its children with start alignment', () => {
+    const actions = 'animi et omnis';
+
+    render(<CardActions alignment="start">{actions}</CardActions>);
+
+    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: flex-start`);
+  });
+
+  it('can render its children with centered alignment', () => {
+    const actions = 'animi et omnis';
+
+    render(<CardActions alignment="center">{actions}</CardActions>);
+
+    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: center`);
+  });
+
+  it('can render its children with end alignment', () => {
+    const actions = 'animi et omnis';
+
+    render(<CardActions alignment="end">{actions}</CardActions>);
+
+    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: flex-end`);
+  });
+});
-- 
cgit v1.2.3

