@redocly/theme-experimental 0.8.0-next.0 → 0.8.0-next.2
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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
4
|
+
|
|
3
5
|
import { Card } from '../Card';
|
|
4
6
|
import { renderWithRouter } from '../../../tests/utils';
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
vi.mock('@redocly/theme/hooks/useThemeHooks');
|
|
7
9
|
|
|
8
10
|
const links = {
|
|
9
11
|
type: 'group' as const,
|
|
@@ -37,18 +39,25 @@ describe('Card', () => {
|
|
|
37
39
|
|
|
38
40
|
it('renders the title when provided', () => {
|
|
39
41
|
const screen = renderWithRouter(<Card {...props} />);
|
|
40
|
-
|
|
42
|
+
const titleElement = screen.getByText('Example Card');
|
|
43
|
+
expect(titleElement).toBeTruthy();
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
it('renders the icon when provided', () => {
|
|
44
47
|
const screen = renderWithRouter(<Card {...props} />);
|
|
45
|
-
|
|
48
|
+
const iconElement = screen.getByAltText('Example Card');
|
|
49
|
+
expect(iconElement).toBeTruthy();
|
|
50
|
+
expect(iconElement.getAttribute('src')).toBe('example.png');
|
|
46
51
|
});
|
|
47
52
|
|
|
48
53
|
it('renders the links when provided', () => {
|
|
49
54
|
const screen = renderWithRouter(<Card {...props} />);
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
const link1Element = screen.getByText('Link 1');
|
|
56
|
+
const link2Element = screen.getByText('Link 2');
|
|
57
|
+
expect(link1Element).toBeTruthy();
|
|
58
|
+
expect(link2Element).toBeTruthy();
|
|
59
|
+
expect(link1Element.getAttribute('href')).toBe('/#1');
|
|
60
|
+
expect(link2Element.getAttribute('href')).toBe('/#2');
|
|
52
61
|
});
|
|
53
62
|
|
|
54
63
|
it('does not render the title when not provided', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme-experimental",
|
|
3
|
-
"version": "0.8.0-next.
|
|
3
|
+
"version": "0.8.0-next.2",
|
|
4
4
|
"description": "Experimental UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme-experimental",
|
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
"@markdoc/markdoc": "0.5.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@testing-library/jest-dom": "6.6.3",
|
|
26
25
|
"@testing-library/react": "16.3.0",
|
|
27
26
|
"@testing-library/user-event": "14.6.1",
|
|
28
27
|
"@types/highlight-words-core": "1.2.3",
|
|
29
|
-
"@types/jest": "29.5.11",
|
|
30
|
-
"@types/jest-when": "3.5.5",
|
|
31
28
|
"@types/lodash.throttle": "4.1.9",
|
|
32
29
|
"@types/node": "22.15.3",
|
|
33
30
|
"@types/prismjs": "1.26.4",
|
|
@@ -35,11 +32,8 @@
|
|
|
35
32
|
"@types/react-dom": "^19.1.4",
|
|
36
33
|
"@types/styled-components": "5.1.34",
|
|
37
34
|
"@types/styled-system": "5.1.22",
|
|
35
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
38
36
|
"concurrently": "7.6.0",
|
|
39
|
-
"jest": "29.5.0",
|
|
40
|
-
"jest-environment-jsdom": "29.5.0",
|
|
41
|
-
"jest-styled-components": "7.2.0",
|
|
42
|
-
"jest-when": "3.6.0",
|
|
43
37
|
"json-schema-to-ts": "2.7.2",
|
|
44
38
|
"lodash.throttle": "4.1.1",
|
|
45
39
|
"npm-run-all2": "5.0.2",
|
|
@@ -48,24 +42,29 @@
|
|
|
48
42
|
"rimraf": "5.0.7",
|
|
49
43
|
"styled-components": "5.3.11",
|
|
50
44
|
"styled-system": "5.1.5",
|
|
51
|
-
"ts-jest": "29.1.2",
|
|
52
45
|
"ts-node": "10.9.2",
|
|
53
46
|
"ts-node-dev": "2.0.0",
|
|
54
47
|
"tsc-alias": "1.8.10",
|
|
55
48
|
"tsconfig-paths": "4.2.0",
|
|
56
49
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
57
50
|
"typescript": "5.6.2",
|
|
51
|
+
"vitest": "3.2.4",
|
|
58
52
|
"webpack": "5.94.0"
|
|
59
53
|
},
|
|
60
54
|
"dependencies": {
|
|
61
55
|
"@redocly/config": "0.28.0",
|
|
62
|
-
"@redocly/theme": "0.57.0-next.
|
|
56
|
+
"@redocly/theme": "0.57.0-next.2"
|
|
63
57
|
},
|
|
64
58
|
"scripts": {
|
|
65
59
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
66
60
|
"ts:check": "tsc --noEmit --skipLibCheck",
|
|
67
61
|
"clean": "rimraf lib",
|
|
68
62
|
"compile": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
69
|
-
"build": "npm run clean && npm run compile"
|
|
63
|
+
"build": "npm run clean && npm run compile",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:update": "vitest run --update",
|
|
66
|
+
"test:watch": "vitest",
|
|
67
|
+
"test:coverage": "vitest run --coverage",
|
|
68
|
+
"test:coverage:html": "vitest run --coverage --reporter=html"
|
|
70
69
|
}
|
|
71
70
|
}
|