@stackshift-ui/heading 6.0.11 → 7.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackshift-ui/heading",
3
3
  "description": "",
4
- "version": "6.0.11",
4
+ "version": "7.0.0-beta.0",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -29,20 +29,21 @@
29
29
  "typescript": "^5.6.2",
30
30
  "vite-tsconfig-paths": "^5.0.1",
31
31
  "vitest": "^2.1.1",
32
- "@stackshift-ui/eslint-config": "6.0.10",
33
- "@stackshift-ui/typescript-config": "6.0.10"
32
+ "@stackshift-ui/typescript-config": "6.0.10",
33
+ "@stackshift-ui/eslint-config": "6.0.10"
34
34
  },
35
35
  "dependencies": {
36
+ "@testing-library/jest-dom": "^6.5.0",
36
37
  "classnames": "^2.5.1",
37
- "@stackshift-ui/system": "6.0.11",
38
- "@stackshift-ui/scripts": "6.0.10"
38
+ "@stackshift-ui/scripts": "6.1.0-beta.0",
39
+ "@stackshift-ui/system": "6.1.0-beta.0"
39
40
  },
40
41
  "peerDependencies": {
42
+ "@stackshift-ui/system": ">=6.1.0-beta.0",
41
43
  "@types/react": "16.8 - 19",
42
44
  "next": "10 - 14",
43
45
  "react": "16.8 - 19",
44
- "react-dom": "16.8 - 19",
45
- "@stackshift-ui/system": ">=6.0.11"
46
+ "react-dom": "16.8 - 19"
46
47
  },
47
48
  "peerDependenciesMeta": {
48
49
  "next": {
@@ -7,7 +7,44 @@ describe.concurrent("heading", () => {
7
7
 
8
8
  test("Common: Heading - test if renders without errors", ({ expect }) => {
9
9
  const clx = "heading-class";
10
- render(<Heading className={clx} />);
11
- expect(screen.getByTestId("h1").classList).toContain(clx);
10
+ const { unmount } = render(<Heading className={clx}>Test Heading</Heading>);
11
+
12
+ const heading = screen.getByRole("heading", { name: "Test Heading", level: 1 });
13
+ expect(heading).toBeInTheDocument();
14
+ expect(heading.classList).toContain(clx);
15
+ unmount();
16
+ });
17
+
18
+ test("Common: Heading - test with different heading type", ({ expect }) => {
19
+ const { unmount } = render(
20
+ <>
21
+ <Heading data-testid="Heading1" type="h1">
22
+ Test H1
23
+ </Heading>
24
+ <Heading data-testid="Heading2" type="h2">
25
+ Test H2
26
+ </Heading>
27
+ <Heading data-testid="Heading3" type="h3">
28
+ Test H3
29
+ </Heading>
30
+ <Heading data-testid="Heading4" type="h4">
31
+ Test H4
32
+ </Heading>
33
+ <Heading data-testid="Heading5" type="h5">
34
+ Test H5
35
+ </Heading>
36
+ <Heading data-testid="Heading6" type="h6">
37
+ Test H6
38
+ </Heading>
39
+ </>,
40
+ );
41
+
42
+ expect(screen.getByRole("heading", { name: "Test H1", level: 1 })).toBeInTheDocument();
43
+ expect(screen.getByRole("heading", { name: "Test H2", level: 2 })).toBeInTheDocument();
44
+ expect(screen.getByRole("heading", { name: "Test H3", level: 3 })).toBeInTheDocument();
45
+ expect(screen.getByRole("heading", { name: "Test H4", level: 4 })).toBeInTheDocument();
46
+ expect(screen.getByRole("heading", { name: "Test H5", level: 5 })).toBeInTheDocument();
47
+ expect(screen.getByRole("heading", { name: "Test H6", level: 6 })).toBeInTheDocument();
48
+ unmount();
12
49
  });
13
50
  });
package/src/heading.tsx CHANGED
@@ -84,11 +84,7 @@ export const Heading: React.FC<HeadingProps> = ({
84
84
  const variantClass = variants[Element] ?? variants.h1;
85
85
 
86
86
  return (
87
- <Component
88
- as={type}
89
- className={cn(variantClass, className)}
90
- {...props}
91
- data-testid={displayName}>
87
+ <Component as={type} className={cn(variantClass, className)} {...props}>
92
88
  {children}
93
89
  </Component>
94
90
  );
@@ -0,0 +1,4 @@
1
+ import '@testing-library/jest-dom';
2
+
3
+ export { };
4
+