@salutejs/sdds-api-tests 0.13.0-next-sbcom.0 → 0.13.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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salutejs/sdds-api-tests",
|
|
3
|
-
"version": "0.13.0
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "API tests for components",
|
|
5
5
|
"author": "Salute Frontend Team <salute.developers@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,19 +13,19 @@
|
|
|
13
13
|
"test": "rm -rf tests && node script.mjs && NODE_OPTIONS=--max-old-space-size=8192 tsc --noEmit -p ./tsconfig.typecheck.json"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@salutejs/plasma-b2c": "1.624.0
|
|
17
|
-
"@salutejs/plasma-giga": "0.351.0
|
|
18
|
-
"@salutejs/plasma-icons": "1.242.0
|
|
19
|
-
"@salutejs/plasma-web": "1.626.0
|
|
20
|
-
"@salutejs/sdds-bizcom": "0.356.0
|
|
21
|
-
"@salutejs/sdds-cs": "0.360.0
|
|
22
|
-
"@salutejs/sdds-dfa": "0.354.0
|
|
23
|
-
"@salutejs/sdds-finai": "0.347.0
|
|
24
|
-
"@salutejs/sdds-insol": "0.351.0
|
|
25
|
-
"@salutejs/sdds-netology": "0.355.0
|
|
26
|
-
"@salutejs/sdds-platform-ai": "0.355.0
|
|
27
|
-
"@salutejs/sdds-scan": "0.354.0
|
|
28
|
-
"@salutejs/sdds-serv": "0.355.0
|
|
16
|
+
"@salutejs/plasma-b2c": "1.624.0",
|
|
17
|
+
"@salutejs/plasma-giga": "0.351.0",
|
|
18
|
+
"@salutejs/plasma-icons": "1.242.0",
|
|
19
|
+
"@salutejs/plasma-web": "1.626.0",
|
|
20
|
+
"@salutejs/sdds-bizcom": "0.356.0",
|
|
21
|
+
"@salutejs/sdds-cs": "0.360.0",
|
|
22
|
+
"@salutejs/sdds-dfa": "0.354.0",
|
|
23
|
+
"@salutejs/sdds-finai": "0.347.0",
|
|
24
|
+
"@salutejs/sdds-insol": "0.351.0",
|
|
25
|
+
"@salutejs/sdds-netology": "0.355.0",
|
|
26
|
+
"@salutejs/sdds-platform-ai": "0.355.0",
|
|
27
|
+
"@salutejs/sdds-scan": "0.354.0",
|
|
28
|
+
"@salutejs/sdds-serv": "0.355.0",
|
|
29
29
|
"@types/node": "^25.9.1",
|
|
30
30
|
"@types/react": "18.0.28",
|
|
31
31
|
"@types/react-dom": "18.0.11",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "943a8d7362903f1a335fa5a99917fcbf0f673ea6"
|
|
39
39
|
}
|
package/script.mjs
CHANGED
|
@@ -13,43 +13,50 @@ const config = {
|
|
|
13
13
|
libs: [
|
|
14
14
|
{
|
|
15
15
|
name: '@salutejs/plasma-b2c',
|
|
16
|
-
excludeComponents: ['TextField'],
|
|
16
|
+
excludeComponents: ['TextField', 'CodeArea'],
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
name: '@salutejs/plasma-web',
|
|
20
|
-
excludeComponents: ['TextField'],
|
|
20
|
+
excludeComponents: ['TextField', 'CodeArea'],
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
name: '@salutejs/plasma-giga',
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: '@salutejs/sdds-bizcom',
|
|
27
|
+
excludeComponents: ['CodeArea'],
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
name: '@salutejs/sdds-cs',
|
|
30
|
-
excludeComponents: ['Select', 'InformationWrapper'],
|
|
31
|
+
excludeComponents: ['Select', 'InformationWrapper', 'CodeArea'],
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
name: '@salutejs/sdds-dfa',
|
|
34
|
-
excludeComponents: ['InformationWrapper'],
|
|
35
|
+
excludeComponents: ['InformationWrapper', 'CodeArea'],
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
name: '@salutejs/sdds-finai',
|
|
39
|
+
excludeComponents: ['CodeArea'],
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
42
|
name: '@salutejs/sdds-insol',
|
|
43
|
+
excludeComponents: ['CodeArea'],
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
46
|
name: '@salutejs/sdds-netology',
|
|
47
|
+
excludeComponents: ['CodeArea'],
|
|
44
48
|
},
|
|
45
49
|
{
|
|
46
50
|
name: '@salutejs/sdds-platform-ai',
|
|
51
|
+
excludeComponents: ['CodeArea'],
|
|
47
52
|
},
|
|
48
53
|
{
|
|
49
54
|
name: '@salutejs/sdds-scan',
|
|
55
|
+
excludeComponents: ['CodeArea'],
|
|
50
56
|
},
|
|
51
57
|
{
|
|
52
58
|
name: '@salutejs/sdds-serv',
|
|
59
|
+
excludeComponents: ['CodeArea'],
|
|
53
60
|
},
|
|
54
61
|
],
|
|
55
62
|
includeComponents: [],
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AriaRole, ComponentProps, CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { describe, it } from 'node:test';
|
|
4
|
+
import { expectTypeOf } from 'expect-type';
|
|
5
|
+
import { CodeArea } from '@salutejs/plasma-b2c';
|
|
6
|
+
|
|
7
|
+
type CodeAreaProps = ComponentProps<typeof CodeArea>;
|
|
8
|
+
|
|
9
|
+
describe('Basics', () => {
|
|
10
|
+
it('Common', () => {
|
|
11
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('children').toEqualTypeOf<string | undefined>();
|
|
12
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('language').toEqualTypeOf<string | undefined>();
|
|
13
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('showLineNumbers').toEqualTypeOf<boolean | undefined>();
|
|
14
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('hasWrapper').toEqualTypeOf<boolean | undefined>();
|
|
15
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('contentOuter').toEqualTypeOf<ReactNode>();
|
|
16
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('contentHeader').toEqualTypeOf<ReactNode>();
|
|
17
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('contentAction').toEqualTypeOf<ReactNode>();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('Variations', () => {
|
|
21
|
+
type View = NonNullable<CodeAreaProps['view']>;
|
|
22
|
+
expectTypeOf<View>().toExtend<string>();
|
|
23
|
+
expectTypeOf<string>().not.toExtend<View>();
|
|
24
|
+
|
|
25
|
+
type Size = NonNullable<CodeAreaProps['size']>;
|
|
26
|
+
expectTypeOf<Size>().toExtend<string>();
|
|
27
|
+
expectTypeOf<string>().not.toExtend<Size>();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('HTMLDivElement', () => {
|
|
31
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('id').toEqualTypeOf<string | undefined>();
|
|
32
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('className').toEqualTypeOf<string | undefined>();
|
|
33
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('style').toEqualTypeOf<CSSProperties | undefined>();
|
|
34
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('aria-label').toEqualTypeOf<string | undefined>();
|
|
35
|
+
expectTypeOf<CodeAreaProps>().toHaveProperty('role').toEqualTypeOf<AriaRole | undefined>();
|
|
36
|
+
expectTypeOf<CodeAreaProps>()
|
|
37
|
+
.toHaveProperty('onClick')
|
|
38
|
+
.toEqualTypeOf<React.MouseEventHandler<HTMLDivElement> | undefined>();
|
|
39
|
+
expectTypeOf<CodeAreaProps>()
|
|
40
|
+
.toHaveProperty('onMouseEnter')
|
|
41
|
+
.toEqualTypeOf<React.MouseEventHandler<HTMLDivElement> | undefined>();
|
|
42
|
+
expectTypeOf<CodeAreaProps>()
|
|
43
|
+
.toHaveProperty('onMouseLeave')
|
|
44
|
+
.toEqualTypeOf<React.MouseEventHandler<HTMLDivElement> | undefined>();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('Examples', () => {
|
|
49
|
+
it('Basic', () => {
|
|
50
|
+
() => {
|
|
51
|
+
return <CodeArea language="json">{'{"status":"ok"}'}</CodeArea>;
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('With line numbers', () => {
|
|
56
|
+
() => {
|
|
57
|
+
return (
|
|
58
|
+
<CodeArea language="javascript" showLineNumbers>
|
|
59
|
+
const status = true;
|
|
60
|
+
</CodeArea>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('With slots and wrapper', () => {
|
|
66
|
+
() => {
|
|
67
|
+
return (
|
|
68
|
+
<CodeArea
|
|
69
|
+
contentAction={<button type="button">Copy</button>}
|
|
70
|
+
contentHeader={<div>Header</div>}
|
|
71
|
+
contentOuter={<div>Outer</div>}
|
|
72
|
+
hasWrapper
|
|
73
|
+
language="text"
|
|
74
|
+
>
|
|
75
|
+
Text
|
|
76
|
+
</CodeArea>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -101,7 +101,7 @@ describe('Basics', () => {
|
|
|
101
101
|
expectTypeOf<SelectProps>()
|
|
102
102
|
.toHaveProperty('renderTarget')
|
|
103
103
|
.toEqualTypeOf<
|
|
104
|
-
| ((value: ItemOption, opened?: boolean) => ReactNode)
|
|
104
|
+
| ((value: ItemOption | null, opened?: boolean) => ReactNode)
|
|
105
105
|
| ((value: ItemOption[], opened?: boolean) => ReactNode)
|
|
106
106
|
| undefined
|
|
107
107
|
>();
|