Skip to content

Commit b01e597

Browse files
committed
IBX-10468: Tests cleanup
1 parent c1eadf4 commit b01e597

File tree

7 files changed

+36
-78
lines changed

7 files changed

+36
-78
lines changed

packages/components/src/Accordion/Accordion.test.stories.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ const meta: Meta<typeof Accordion> = {
1111
layout: 'padded',
1212
},
1313
tags: ['!dev'],
14-
argTypes: {
15-
initiallyExpanded: {
16-
control: 'boolean',
17-
},
18-
},
1914
args: { onHandleExpand: fn() },
2015
};
2116

packages/components/src/Button/Button.test.stories.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,20 @@ const meta: Meta<typeof Button> = {
99
layout: 'centered',
1010
},
1111
tags: ['!dev'],
12-
argTypes: {
13-
size: {
14-
control: 'select',
15-
},
16-
type: {
17-
control: 'select',
18-
},
19-
className: {
20-
control: 'text',
21-
},
12+
args: {
13+
type: 'primary',
14+
children: 'Button label',
15+
onClick: fn(),
2216
},
23-
args: { onClick: fn() },
2417
};
2518

2619
export default meta;
2720

2821
type Story = StoryObj<typeof Button>;
2922

30-
export const TestActive: Story = {
31-
name: 'Primary',
23+
export const TestEnabled: Story = {
24+
name: 'Enabled',
3225
args: {
33-
type: 'primary',
34-
children: 'Button label',
3526
disabled: false,
3627
},
3728
play: async ({ canvasElement, step, args }) => {
@@ -53,8 +44,6 @@ export const TestActive: Story = {
5344
export const TestDisabled: Story = {
5445
name: 'Disabled',
5546
args: {
56-
type: 'primary',
57-
children: 'Button label',
5847
disabled: true,
5948
},
6049
play: async ({ canvasElement, step }) => {

packages/components/src/Expander/Expander.test.stories.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@ const meta: Meta<typeof Expander> = {
99
layout: 'centered',
1010
},
1111
tags: ['!dev'],
12-
argTypes: {
13-
hasIcon: {
14-
control: 'boolean',
15-
},
16-
isExpanded: {
17-
control: 'boolean',
18-
},
19-
type: {
20-
control: 'select',
21-
},
12+
args: {
13+
collapseLabel: 'Show more',
14+
expandLabel: 'Show less',
15+
onClick: fn(),
2216
},
23-
args: { onClick: fn() },
2417
};
2518

2619
export default meta;
@@ -30,8 +23,6 @@ type Story = StoryObj<typeof Expander>;
3023
export const ExpanderIsNotExpanded: Story = {
3124
args: {
3225
isExpanded: false,
33-
collapseLabel: 'Show more',
34-
expandLabel: 'Show less',
3526
},
3627
play: async ({ canvasElement, step, args }) => {
3728
const canvas = within(canvasElement);
@@ -56,8 +47,6 @@ export const ExpanderIsNotExpanded: Story = {
5647
export const ExpanderIsExpanded: Story = {
5748
args: {
5849
isExpanded: true,
59-
collapseLabel: 'Show more',
60-
expandLabel: 'Show less',
6150
},
6251
play: async ({ canvasElement, step, args }) => {
6352
const canvas = within(canvasElement);

packages/components/src/IconButton/IconButton.test.stories.tsx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,20 @@ const meta: Meta<typeof IconButton> = {
99
layout: 'centered',
1010
},
1111
tags: ['!dev'],
12-
argTypes: {
13-
size: {
14-
control: 'select',
15-
},
16-
type: {
17-
control: 'select',
18-
},
12+
args: {
13+
type: 'primary',
14+
icon: 'edit',
15+
onClick: fn(),
1916
},
20-
args: { onClick: fn() },
2117
};
2218

2319
export default meta;
2420

2521
type Story = StoryObj<typeof IconButton>;
2622

27-
export const TestActive: Story = {
28-
name: 'Primary',
23+
export const TestEnabled: Story = {
24+
name: 'Enabled',
2925
args: {
30-
type: 'primary',
31-
icon: 'edit',
3226
disabled: false,
3327
},
3428
play: async ({ canvasElement, step, args }) => {
@@ -50,8 +44,6 @@ export const TestActive: Story = {
5044
export const TestDisabled: Story = {
5145
name: 'Disabled',
5246
args: {
53-
type: 'primary',
54-
icon: 'edit',
5547
disabled: true,
5648
},
5749
play: async ({ canvasElement, step }) => {

packages/components/src/inputs/InputText/InputText.test.stories.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,8 @@ const meta: Meta<typeof InputText> = {
99
layout: 'centered',
1010
},
1111
tags: ['!dev'],
12-
argTypes: {
13-
size: {
14-
control: 'select',
15-
},
16-
type: {
17-
control: 'select',
18-
},
19-
className: {
20-
control: 'text',
21-
},
22-
},
2312
args: {
13+
name: 'default-input',
2414
onBlur: fn(),
2515
onChange: fn(),
2616
onFocus: fn(),
@@ -32,26 +22,29 @@ export default meta;
3222

3323
type Story = StoryObj<typeof InputText>;
3424

35-
export const TestActive: Story = {
36-
name: 'Events',
37-
args: {
38-
name: 'default-input',
39-
},
25+
export const Default: Story = {
26+
name: 'Default',
4027
play: async ({ canvasElement, step, args }) => {
4128
const canvas = within(canvasElement);
4229
const input = canvas.getByRole('textbox');
4330

4431
await step('InputText handles focus event', async () => {
4532
await expect(args.onFocus).not.toHaveBeenCalled();
33+
4634
await userEvent.click(input);
35+
4736
await expect(args.onFocus).toHaveBeenCalledOnce();
37+
4838
await userEvent.click(input);
39+
4940
await expect(args.onFocus).toHaveBeenCalledOnce();
5041
});
5142

5243
await step('InputText handles blur event', async () => {
5344
await expect(args.onBlur).not.toHaveBeenCalled();
45+
5446
await userEvent.click(canvasElement);
47+
5548
await expect(args.onBlur).toHaveBeenCalledOnce();
5649
});
5750

@@ -61,6 +54,7 @@ export const TestActive: Story = {
6154
const numberOfExpectedFocusCalls = 2;
6255

6356
await userEvent.type(input, insertText);
57+
6458
await expect(args.onFocus).toHaveBeenCalledTimes(numberOfExpectedFocusCalls);
6559
await expect(args.onChange).toHaveBeenCalledTimes(insertTextLength);
6660
await expect(args.onInput).toHaveBeenCalledTimes(insertTextLength);

packages/components/src/ui/ClearBtn/ClearBtn.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { action } from 'storybook/actions';
33

4-
import Expander from './ClearBtn';
4+
import ClearBtn from './ClearBtn';
55

6-
const meta: Meta<typeof Expander> = {
7-
component: Expander,
6+
const meta: Meta<typeof ClearBtn> = {
7+
component: ClearBtn,
88
parameters: {
99
layout: 'centered',
1010
},
@@ -15,7 +15,7 @@ const meta: Meta<typeof Expander> = {
1515

1616
export default meta;
1717

18-
type Story = StoryObj<typeof Expander>;
18+
type Story = StoryObj<typeof ClearBtn>;
1919

2020
export const Default: Story = {
2121
name: 'Default',

packages/components/src/ui/ClearBtn/ClearBtn.test.stories.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { expect, fn, userEvent, within } from 'storybook/test';
33

4-
import Expander from './ClearBtn';
4+
import ClearBtn from './ClearBtn';
55

6-
const meta: Meta<typeof Expander> = {
7-
component: Expander,
6+
const meta: Meta<typeof ClearBtn> = {
7+
component: ClearBtn,
88
parameters: {
99
layout: 'centered',
1010
},
1111
tags: ['!dev'],
12-
argTypes: {},
1312
args: { onClick: fn() },
1413
};
1514

1615
export default meta;
1716

18-
type Story = StoryObj<typeof Expander>;
17+
type Story = StoryObj<typeof ClearBtn>;
1918

20-
export const TestActive: Story = {
21-
name: 'Primary',
19+
export const TestEnabled: Story = {
20+
name: 'Enabled',
2221
args: {
2322
disabled: false,
2423
},

0 commit comments

Comments
 (0)