Skip to content

Commit 4ed05dd

Browse files
authored
Merge pull request #47 from josephlouise74/main
Improve Test Coverage for Element, Field, Form, and Format Components
2 parents d4c9848 + 15f48fa commit 4ed05dd

File tree

89 files changed

+11078
-1789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+11078
-1789
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,4 @@
252252
"react": "^19",
253253
"react-dom": "^19"
254254
}
255-
}
255+
}

tests/base/Accordion.test.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
//--------------------------------------------------------------------//
22
// Imports
33

4-
//modules
5-
import { describe, expect, it, vi } from 'vitest';
6-
//tests
7-
import '@testing-library/jest-dom';
8-
import { fireEvent, render, screen } from '@testing-library/react';
94
//frui
105
import type { AccordionContextProps } from '../../src/base/Accordion.js';
116
import {
@@ -18,6 +13,19 @@ import {
1813
AccordionLabel,
1914
useAccordionContext
2015
} from '../../src/base/Accordion.js';
16+
//tests
17+
import '@testing-library/jest-dom';
18+
import {
19+
describe,
20+
expect,
21+
it,
22+
vi
23+
} from 'vitest';
24+
import {
25+
fireEvent,
26+
render,
27+
screen
28+
} from '@testing-library/react';
2129

2230
//--------------------------------------------------------------------//
2331
// Tests
@@ -53,7 +61,11 @@ describe('<Accordion />', () => {
5361
it('applies className and triggers onChange', () => {
5462
const onChange = vi.fn();
5563
render(
56-
<Accordion className="custom" defaultValue="a1" onChange={onChange}>
64+
<Accordion
65+
className="custom"
66+
defaultValue="a1"
67+
onChange={onChange}
68+
>
5769
<AccordionBellow value="a1">
5870
<AccordionLabel>Label 1</AccordionLabel>
5971
</AccordionBellow>

tests/base/Alert.test.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
//--------------------------------------------------------------------//
22
// Imports
33

4+
//frui
5+
import { Alert } from '../../src/base/Alert.js';
46
//modules
57
import type { ReactElement, ReactNode } from 'react';
6-
import { describe, expect, it, vi } from 'vitest';
78
//tests
89
import '@testing-library/jest-dom';
10+
import {
11+
describe,
12+
expect,
13+
it,
14+
vi
15+
} from 'vitest';
916
import { render, screen } from '@testing-library/react';
10-
//frui
11-
import { Alert } from '../../src/base/Alert.js';
1217

1318
//--------------------------------------------------------------------//
1419
// Mocks
@@ -134,7 +139,9 @@ describe('<Alert />', () => {
134139
</Alert>
135140
);
136141
const element = screen.getByText('outlined');
137-
expect(element).toHaveClass('frui-alert', 'frui-solid', 'frui-thin');
142+
expect(element).toHaveClass(
143+
'frui-alert', 'frui-solid', 'frui-thin'
144+
);
138145
expect(element.style.borderColor).toBe('blue');
139146
expect(element.style.color).toBe('blue');
140147
});

tests/base/Badge.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//--------------------------------------------------------------------//
22
// Imports
33

4+
//frui
5+
import Badge from '../../src/base/Badge.js';
46
//modules
57
import type {
6-
ReactElement,
7-
ReactNode
8-
} from 'react';
8+
ReactElement, ReactNode } from 'react';
99
//tests
1010
import '@testing-library/jest-dom';
1111
import {
@@ -18,8 +18,6 @@ import {
1818
it,
1919
vi
2020
} from 'vitest';
21-
//frui
22-
import Badge from '../../src/base/Badge.js';
2321

2422
//--------------------------------------------------------------------//
2523
// Mocks

tests/base/Box.test.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
//--------------------------------------------------------------------//
22
// Imports
33

4-
//modules
5-
import { describe, expect, it } from 'vitest';
6-
//tests
7-
import '@testing-library/jest-dom';
8-
import { render, screen } from '@testing-library/react';
94
//frui
105
import Box, {
116
getThemeProps,
@@ -24,6 +19,14 @@ import Box, {
2419
removeThemeProps,
2520
useBox
2621
} from '../../src/base/Box.js';
22+
//tests
23+
import '@testing-library/jest-dom';
24+
import {
25+
describe,
26+
expect,
27+
it
28+
} from 'vitest';
29+
import { render, screen } from '@testing-library/react';
2730

2831
//--------------------------------------------------------------------//
2932
// Tests

0 commit comments

Comments
 (0)