@stackshift-ui/text 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/text",
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,20 @@
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
36
  "classnames": "^2.5.1",
37
- "@stackshift-ui/scripts": "6.0.10",
38
- "@stackshift-ui/system": "6.0.11"
37
+ "@stackshift-ui/system": "6.1.0-beta.0",
38
+ "@stackshift-ui/scripts": "6.1.0-beta.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@types/react": "16.8 - 19",
42
42
  "next": "10 - 14",
43
43
  "react": "16.8 - 19",
44
44
  "react-dom": "16.8 - 19",
45
- "@stackshift-ui/system": ">=6.0.11"
45
+ "@stackshift-ui/system": ">=6.1.0-beta.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "next": {
package/src/text.test.tsx CHANGED
@@ -7,7 +7,80 @@ describe.concurrent("text", () => {
7
7
 
8
8
  test("Common: Text - test if renders without errors", ({ expect }) => {
9
9
  const clx = "text-class";
10
- render(<Text className={clx} />);
11
- expect(screen.getByTestId("p").classList).toContain(clx);
10
+ render(<Text className={clx}>Test text content</Text>);
11
+ const text = screen.getByText("Test text content");
12
+ screen.debug(text);
13
+ expect(text.classList).toContain(clx);
14
+ expect(text.tagName.toLowerCase()).toBe("p"); // default element
15
+ });
16
+
17
+ test("Common: Text - test with different element type", ({ expect }) => {
18
+ render(<Text as="span">Test span</Text>);
19
+ const text = screen.getByText("Test span");
20
+ expect(text.tagName.toLowerCase()).toBe("span");
21
+ });
22
+
23
+ test("Common: Test - test with different sizes", ({ expect }) => {
24
+ render(<Text fontSize="lg">Test large text</Text>);
25
+ const text = screen.getByText("Test large text");
26
+ expect(text.classList).toContain("text-lg");
27
+
28
+ render(<Text fontSize="xl">Test extra large text</Text>);
29
+ const text2 = screen.getByText("Test extra large text");
30
+ expect(text2.classList).toContain("text-xl");
31
+
32
+ render(<Text fontSize="2xl">Test 2x large text</Text>);
33
+ const text3 = screen.getByText("Test 2x large text");
34
+ expect(text3.classList).toContain("text-2xl");
35
+
36
+ render(<Text fontSize="3xl">Test 3x large text</Text>);
37
+ const text4 = screen.getByText("Test 3x large text");
38
+ expect(text4.classList).toContain("text-3xl");
39
+
40
+ render(<Text fontSize="4xl">Test 4x large text</Text>);
41
+ const text5 = screen.getByText("Test 4x large text");
42
+ expect(text5.classList).toContain("text-4xl");
43
+
44
+ render(<Text fontSize="5xl">Test 5x large text</Text>);
45
+ const text6 = screen.getByText("Test 5x large text");
46
+ expect(text6.classList).toContain("text-5xl");
47
+ });
48
+
49
+ test("Common: Text - test with different weights", ({ expect }) => {
50
+ render(<Text weight="bold">Test bold text</Text>);
51
+ const text = screen.getByText("Test bold text");
52
+ expect(text.classList).toContain("font-bold");
53
+
54
+ render(<Text weight="semibold">Test semibold text</Text>);
55
+ const text2 = screen.getByText("Test semibold text");
56
+ expect(text2.classList).toContain("font-semibold");
57
+
58
+ render(<Text weight="medium">Test medium text</Text>);
59
+ const text3 = screen.getByText("Test medium text");
60
+ expect(text3.classList).toContain("font-medium");
61
+ });
62
+
63
+ test("Common: Text - test with muted", ({ expect }) => {
64
+ render(<Text muted>Test muted text</Text>);
65
+ const text = screen.getByText("Test muted text");
66
+ expect(text.classList).toContain("text-gray-500");
67
+ });
68
+
69
+ test("Common: Text - test with custom class", ({ expect }) => {
70
+ render(<Text className="custom-class">Test custom class</Text>);
71
+ const text = screen.getByText("Test custom class");
72
+ expect(text.classList).toContain("custom-class");
73
+ });
74
+
75
+ test("Common: Text - test with custom style", ({ expect }) => {
76
+ render(<Text style={{ color: "red" }}>Test custom style</Text>);
77
+ const text = screen.getByText("Test custom style");
78
+ expect(text.style.color).toBe("red");
79
+ });
80
+
81
+ test("Common: Text - test with as prop", ({ expect }) => {
82
+ render(<Text as="h1">Test as prop</Text>);
83
+ const text = screen.getByText("Test as prop");
84
+ expect(text.tagName.toLowerCase()).toBe("h1");
12
85
  });
13
86
  });
package/src/text.tsx CHANGED
@@ -62,7 +62,7 @@ export const Text: React.FC<TextProps> = ({
62
62
  normal: "font-normal",
63
63
  semibold: "font-semibold",
64
64
  bold: "font-bold",
65
- medium: "font-mediun",
65
+ medium: "font-medium",
66
66
  extrabold: "font-extrabold",
67
67
  black: "font-black",
68
68
  };
@@ -77,12 +77,7 @@ export const Text: React.FC<TextProps> = ({
77
77
  const variantClass = variants[type as VariantType] ?? variants.p;
78
78
 
79
79
  return (
80
- <Component
81
- as={as}
82
- className={cn(variantClass, className)}
83
- style={style}
84
- {...props}
85
- data-testid={displayName}>
80
+ <Component as={as} className={cn(variantClass, className)} style={style} {...props}>
86
81
  {children}
87
82
  </Component>
88
83
  );