Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
439 changes: 439 additions & 0 deletions .tasks/NEW_COMPONENT.md

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions __tests__/Accordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
} from '../src';

const basicItems = [
{ title: 'Item 1', content: 'Content 1' },
{ title: 'Item 2', content: 'Content 2' },
{ title: 'Item 3', content: 'Content 3' },
{ label: 'Item 1', content: 'Content 1' },
{ label: 'Item 2', content: 'Content 2' },
{ label: 'Item 3', content: 'Content 3' },
];

test('Renders <Accordion /> with items', () => {
Expand Down Expand Up @@ -76,8 +76,8 @@ test('Respects isOpen default state', () => {
<ReqoreContent>
<ReqoreAccordion
items={[
{ title: 'Open', content: 'Open content', isOpen: true },
{ title: 'Closed', content: 'Closed content' },
{ label: 'Open', content: 'Open content', isOpen: true },
{ label: 'Closed', content: 'Closed content' },
]}
/>
</ReqoreContent>
Expand Down Expand Up @@ -143,8 +143,8 @@ test('Renders with icons', () => {
<ReqoreContent>
<ReqoreAccordion
items={[
{ title: 'With icon', content: 'Content', icon: 'Settings3Line' },
{ title: 'No icon', content: 'Content' },
{ label: 'With icon', content: 'Content', icon: 'Settings3Line' },
{ label: 'No icon', content: 'Content' },
]}
/>
</ReqoreContent>
Expand All @@ -162,16 +162,16 @@ test('Renders with badges', () => {
<ReqoreContent>
<ReqoreAccordion
items={[
{ title: 'With badge', content: 'Content', badge: 5 },
{ title: 'No badge', content: 'Content' },
{ label: 'With badge', content: 'Content', badge: 5 },
{ label: 'No badge', content: 'Content' },
]}
/>
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-accordion-badge').length).toBe(1);
expect(document.querySelectorAll('.reqore-button-badge').length).toBe(1);
});

test('Disabled items cannot be toggled', () => {
Expand All @@ -181,8 +181,8 @@ test('Disabled items cannot be toggled', () => {
<ReqoreContent>
<ReqoreAccordion
items={[
{ title: 'Disabled', content: 'Content', disabled: true },
{ title: 'Normal', content: 'Content' },
{ label: 'Disabled', content: 'Content', disabled: true },
{ label: 'Normal', content: 'Content' },
]}
/>
</ReqoreContent>
Expand Down Expand Up @@ -304,8 +304,8 @@ test('Renders with item-level intents', () => {
<ReqoreContent>
<ReqoreAccordion
items={[
{ title: 'Info', content: 'Content', intent: 'info' },
{ title: 'Danger', content: 'Content', intent: 'danger' },
{ label: 'Info', content: 'Content', intent: 'info' },
{ label: 'Danger', content: 'Content', intent: 'danger' },
]}
/>
</ReqoreContent>
Expand Down Expand Up @@ -352,7 +352,7 @@ test('Renders custom React content', () => {
<ReqoreAccordion
items={[
{
title: 'Custom',
label: 'Custom',
content: <div className='custom-content'>Custom element</div>,
isOpen: true,
},
Expand Down
72 changes: 72 additions & 0 deletions __tests__/Callout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,75 @@ test('Renders <Callout /> with raised effect', () => {

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});

test('Renders <Callout /> with padded=false', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreCallout label='Unpadded' padded={false} />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});

test('Renders <Callout /> with padded="horizontal"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreCallout label='Horizontal' padded='horizontal' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});

test('Renders <Callout /> with padded="vertical"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreCallout label='Vertical' padded='vertical' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});

test('Renders <Callout /> with custom paddingSize', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreCallout label='Big, small padding' size='big' paddingSize='small' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});

test('Renders <Callout /> with padded=false + accent reserves accentSize', () => {
// Even when padded={false} is set, the side that hosts the accent strip
// must reserve accentSize so content does not collide with the strip.
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreCallout label='Reserve' padded={false} accentPosition='top' accentSize={8} />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-callout').length).toBe(1);
});
121 changes: 121 additions & 0 deletions __tests__/EntityRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,127 @@ test('Renders <EntityRow /> with wrap=true by default', () => {
expect(document.querySelectorAll('.reqore-entity-row-description').length).toBe(1);
});

test('Hides the icon tile by default when transparent', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Transparent' icon='PlayCircleLine' transparent />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

// No tinted tile in transparent mode by default
expect(document.querySelectorAll('.reqore-entity-row-icon-tile').length).toBe(0);
// Bare icon is still rendered
expect(document.querySelectorAll('.reqore-entity-row-icon').length).toBe(1);
});

test('Shows the icon tile on a transparent row when iconHasBackground={true}', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow
label='Transparent + tile'
icon='PlayCircleLine'
transparent
iconHasBackground
/>
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row-icon-tile').length).toBe(1);
});

test('Renders <EntityRow /> with iconHasBackground=false (bare icon, no tile)', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Bare' icon='PlayCircleLine' iconHasBackground={false} />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row-icon-tile').length).toBe(0);
expect(document.querySelectorAll('.reqore-entity-row-icon').length).toBe(1);
});

test('Renders <EntityRow /> with padded=false', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Unpadded' padded={false} />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row').length).toBe(1);
});

test('Renders <EntityRow /> with padded="horizontal"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Horizontal only' padded='horizontal' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row').length).toBe(1);
});

test('Renders <EntityRow /> with padded="vertical"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Vertical only' padded='vertical' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row').length).toBe(1);
});

test('Renders <EntityRow /> with custom paddingSize', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Big content, small padding' size='big' paddingSize='small' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row').length).toBe(1);
});

test('Renders <EntityRow /> with iconHasBackground=true by default (tile shown)', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreEntityRow label='Tiled' icon='PlayCircleLine' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-entity-row-icon-tile').length).toBe(1);
});

test('Renders <EntityRow /> with raised effect', () => {
render(
<ReqoreUIProvider>
Expand Down
56 changes: 56 additions & 0 deletions __tests__/FeatureCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,59 @@ test('Renders <FeatureCard /> with raised effect', () => {

expect(document.querySelectorAll('.reqore-feature-card').length).toBe(1);
});

test('Renders <FeatureCard /> with padded=false', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreFeatureCard label='Unpadded' padded={false} />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-feature-card').length).toBe(1);
});

test('Renders <FeatureCard /> with padded="horizontal"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreFeatureCard label='Horizontal' padded='horizontal' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-feature-card').length).toBe(1);
});

test('Renders <FeatureCard /> with padded="vertical"', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreFeatureCard label='Vertical' padded='vertical' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-feature-card').length).toBe(1);
});

test('Renders <FeatureCard /> with custom paddingSize', () => {
render(
<ReqoreUIProvider>
<ReqoreLayoutContent>
<ReqoreContent>
<ReqoreFeatureCard label='Big size, small padding' size='big' paddingSize='small' />
</ReqoreContent>
</ReqoreLayoutContent>
</ReqoreUIProvider>
);

expect(document.querySelectorAll('.reqore-feature-card').length).toBe(1);
});
Loading
Loading