@gravity-ui/page-constructor 1.12.0 → 1.12.1-alpha.1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/build/cjs/blocks/CardLayout/schema.d.ts +22 -24
  3. package/build/cjs/blocks/CardLayout/schema.js +1 -6
  4. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +16 -17
  5. package/build/cjs/blocks/ExtendedFeatures/schema.js +1 -6
  6. package/build/cjs/blocks/HeaderSlider/schema.d.ts +0 -25
  7. package/build/cjs/blocks/LinkTable/schema.d.ts +29 -21
  8. package/build/cjs/blocks/LinkTable/schema.js +1 -1
  9. package/build/cjs/blocks/Media/schema.js +1 -1
  10. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +14 -15
  11. package/build/cjs/blocks/PromoFeaturesBlock/schema.js +1 -6
  12. package/build/cjs/blocks/Slider/Slider.d.ts +1 -6
  13. package/build/cjs/blocks/Slider/schema.d.ts +28 -49
  14. package/build/cjs/blocks/Slider/schema.js +1 -6
  15. package/build/cjs/blocks/Tabs/schema.d.ts +29 -25
  16. package/build/cjs/blocks/Tabs/schema.js +1 -4
  17. package/build/cjs/components/Author/Author.js +2 -2
  18. package/build/cjs/components/Author/__tests__/Author.test.d.ts +1 -0
  19. package/build/cjs/components/Author/__tests__/Author.test.js +49 -0
  20. package/build/cjs/components/BlockHeader/BlockHeader.css +8 -19
  21. package/build/cjs/components/BlockHeader/BlockHeader.js +4 -3
  22. package/build/cjs/grid/Grid/Grid.css +16 -16
  23. package/build/cjs/models/constructor-items/common.d.ts +1 -0
  24. package/build/cjs/navigation/components/Header/Header.css +5 -3
  25. package/build/cjs/navigation/components/Logo/Logo.css +5 -6
  26. package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -0
  27. package/build/cjs/schema/validators/common.d.ts +31 -0
  28. package/build/cjs/schema/validators/common.js +10 -1
  29. package/build/cjs/sub-blocks/CardWithImage/schema.js +1 -1
  30. package/build/cjs/text-transform/blocks.js +44 -54
  31. package/build/esm/blocks/CardLayout/schema.d.ts +22 -24
  32. package/build/esm/blocks/CardLayout/schema.js +2 -7
  33. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +16 -17
  34. package/build/esm/blocks/ExtendedFeatures/schema.js +2 -7
  35. package/build/esm/blocks/HeaderSlider/schema.d.ts +0 -25
  36. package/build/esm/blocks/LinkTable/schema.d.ts +29 -21
  37. package/build/esm/blocks/LinkTable/schema.js +2 -2
  38. package/build/esm/blocks/Media/schema.js +1 -1
  39. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +14 -15
  40. package/build/esm/blocks/PromoFeaturesBlock/schema.js +2 -7
  41. package/build/esm/blocks/Slider/Slider.d.ts +1 -6
  42. package/build/esm/blocks/Slider/schema.d.ts +28 -49
  43. package/build/esm/blocks/Slider/schema.js +2 -7
  44. package/build/esm/blocks/Tabs/schema.d.ts +29 -25
  45. package/build/esm/blocks/Tabs/schema.js +2 -5
  46. package/build/esm/components/Author/Author.js +2 -2
  47. package/build/esm/components/Author/__tests__/Author.test.d.ts +1 -0
  48. package/build/esm/components/Author/__tests__/Author.test.js +46 -0
  49. package/build/esm/components/BlockHeader/BlockHeader.css +8 -19
  50. package/build/esm/components/BlockHeader/BlockHeader.js +5 -4
  51. package/build/esm/grid/Grid/Grid.css +16 -16
  52. package/build/esm/models/constructor-items/common.d.ts +1 -0
  53. package/build/esm/navigation/components/Header/Header.css +5 -3
  54. package/build/esm/navigation/components/Logo/Logo.css +5 -6
  55. package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -0
  56. package/build/esm/schema/validators/common.d.ts +31 -0
  57. package/build/esm/schema/validators/common.js +9 -0
  58. package/build/esm/sub-blocks/CardWithImage/schema.js +1 -1
  59. package/build/esm/text-transform/blocks.js +44 -54
  60. package/package.json +2 -3
  61. package/server/models/constructor-items/common.d.ts +1 -0
  62. package/server/text-transform/blocks.js +44 -54
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.12.1](https://github.com/gravity-ui/page-constructor/compare/v1.12.0...v1.12.1) (2023-01-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **BlockHeader:** add yfm to description, change styles ([#105](https://github.com/gravity-ui/page-constructor/issues/105)) ([f77fc5e](https://github.com/gravity-ui/page-constructor/commit/f77fc5e82f7aaf33dda8f56a9f17a87d61cc5cdd))
9
+ * contentBase import ([#109](https://github.com/gravity-ui/page-constructor/issues/109)) ([2136f7b](https://github.com/gravity-ui/page-constructor/commit/2136f7bbe340c6035c655ff5139ae69ee1b50d3e))
10
+
3
11
  ## [1.12.0](https://github.com/gravity-ui/page-constructor/compare/v1.11.1...v1.12.0) (2023-01-10)
4
12
 
5
13
 
@@ -534,7 +542,7 @@ In the `Content`, if the `text` block has no `title`, the `margin-top` property
534
542
  ### Breaking changes
535
543
 
536
544
  - `PageConstructorProvider` is now a separate component. For the `PageConstructor` to run properly, wrap it in this provider.
537
- For details, see the [readme](https://github.yandex-team.ru/data-ui/page-constructor/blob/master/README.md#начало-работы) file.
545
+ For details, see the [readme](https://github.com/gravity-ui/page-constructor#getting-started) file.
538
546
 
539
547
  - Deleted the `system` theme (the `light` theme is used instead by default).
540
548
 
@@ -2,6 +2,17 @@ export declare const CardLayoutProps: {
2
2
  additionalProperties: boolean;
3
3
  required: string[];
4
4
  properties: {
5
+ colSizes: {
6
+ type: string;
7
+ additionalProperties: boolean;
8
+ properties: {};
9
+ };
10
+ children: {
11
+ type: string;
12
+ items: {
13
+ $ref: string;
14
+ };
15
+ };
5
16
  title: {
6
17
  oneOf: ({
7
18
  type: string;
@@ -25,24 +36,12 @@ export declare const CardLayoutProps: {
25
36
  };
26
37
  } | {
27
38
  type: string;
28
- contentType: string;
29
39
  })[];
30
40
  };
31
41
  description: {
32
42
  type: string;
33
43
  contentType: string;
34
44
  };
35
- colSizes: {
36
- type: string;
37
- additionalProperties: boolean;
38
- properties: {};
39
- };
40
- children: {
41
- type: string;
42
- items: {
43
- $ref: string;
44
- };
45
- };
46
45
  animated: {
47
46
  type: string;
48
47
  };
@@ -76,6 +75,17 @@ export declare const CardLayoutBlock: {
76
75
  additionalProperties: boolean;
77
76
  required: string[];
78
77
  properties: {
78
+ colSizes: {
79
+ type: string;
80
+ additionalProperties: boolean;
81
+ properties: {};
82
+ };
83
+ children: {
84
+ type: string;
85
+ items: {
86
+ $ref: string;
87
+ };
88
+ };
79
89
  title: {
80
90
  oneOf: ({
81
91
  type: string;
@@ -99,24 +109,12 @@ export declare const CardLayoutBlock: {
99
109
  };
100
110
  } | {
101
111
  type: string;
102
- contentType: string;
103
112
  })[];
104
113
  };
105
114
  description: {
106
115
  type: string;
107
116
  contentType: string;
108
117
  };
109
- colSizes: {
110
- type: string;
111
- additionalProperties: boolean;
112
- properties: {};
113
- };
114
- children: {
115
- type: string;
116
- items: {
117
- $ref: string;
118
- };
119
- };
120
118
  animated: {
121
119
  type: string;
122
120
  };
@@ -5,12 +5,7 @@ const common_1 = require("../../schema/validators/common");
5
5
  exports.CardLayoutProps = {
6
6
  additionalProperties: false,
7
7
  required: ['title'],
8
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), { title: {
9
- oneOf: [{ type: 'string', contentType: 'text' }, common_1.TitleProps],
10
- }, description: {
11
- type: 'string',
12
- contentType: 'yfm',
13
- }, colSizes: common_1.containerSizesObject, children: common_1.ChildrenCardsProps }),
8
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { colSizes: common_1.containerSizesObject, children: common_1.ChildrenCardsProps }),
14
9
  };
15
10
  exports.CardLayoutBlock = {
16
11
  'card-layout-block': exports.CardLayoutProps,
@@ -55,6 +55,22 @@ export declare const ExtendedFeaturesBlock: {
55
55
  additionalProperties: boolean;
56
56
  required: never[];
57
57
  properties: {
58
+ items: {
59
+ type: string;
60
+ items: {
61
+ type: string;
62
+ properties: {
63
+ when: {
64
+ type: string;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ colSizes: {
70
+ type: string;
71
+ additionalProperties: boolean;
72
+ properties: {};
73
+ };
58
74
  title: {
59
75
  oneOf: ({
60
76
  type: string;
@@ -78,29 +94,12 @@ export declare const ExtendedFeaturesBlock: {
78
94
  };
79
95
  } | {
80
96
  type: string;
81
- contentType: string;
82
97
  })[];
83
98
  };
84
99
  description: {
85
100
  type: string;
86
101
  contentType: string;
87
102
  };
88
- items: {
89
- type: string;
90
- items: {
91
- type: string;
92
- properties: {
93
- when: {
94
- type: string;
95
- };
96
- };
97
- };
98
- };
99
- colSizes: {
100
- type: string;
101
- additionalProperties: boolean;
102
- properties: {};
103
- };
104
103
  animated: {
105
104
  type: string;
106
105
  };
@@ -29,11 +29,6 @@ exports.ExtendedFeaturesBlock = {
29
29
  'extended-features-block': {
30
30
  additionalProperties: false,
31
31
  required: [],
32
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), { title: {
33
- oneOf: [{ type: 'string', contentType: 'text' }, common_1.TitleProps],
34
- }, description: {
35
- type: 'string',
36
- contentType: 'yfm',
37
- }, items: (0, utils_1.filteredArray)(exports.ExtendedFeaturesItem), colSizes: common_1.containerSizesObject }),
32
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { items: (0, utils_1.filteredArray)(exports.ExtendedFeaturesItem), colSizes: common_1.containerSizesObject }),
38
33
  },
39
34
  };
@@ -346,31 +346,6 @@ export declare const HeaderSliderBlock: {
346
346
  arrows: {
347
347
  type: string;
348
348
  };
349
- description: {
350
- type: string;
351
- contentType: string;
352
- };
353
- title: {
354
- type: string;
355
- additionalProperties: boolean;
356
- required: string[];
357
- properties: {
358
- text: {
359
- type: string;
360
- contentType: string;
361
- };
362
- textSize: {
363
- type: string;
364
- enum: string[];
365
- };
366
- url: {
367
- type: string;
368
- };
369
- resetMargin: {
370
- type: string;
371
- };
372
- };
373
- };
374
349
  randomOrder: {
375
350
  type: string;
376
351
  };
@@ -3,27 +3,6 @@ export declare const LinkTableBlock: {
3
3
  additionalProperties: boolean;
4
4
  required: string[];
5
5
  properties: {
6
- title: {
7
- type: string;
8
- additionalProperties: boolean;
9
- required: string[];
10
- properties: {
11
- text: {
12
- type: string;
13
- contentType: string;
14
- };
15
- textSize: {
16
- type: string;
17
- enum: string[];
18
- };
19
- url: {
20
- type: string;
21
- };
22
- resetMargin: {
23
- type: string;
24
- };
25
- };
26
- };
27
6
  items: {
28
7
  type: string;
29
8
  items: {
@@ -38,6 +17,35 @@ export declare const LinkTableBlock: {
38
17
  };
39
18
  };
40
19
  };
20
+ title: {
21
+ oneOf: ({
22
+ type: string;
23
+ additionalProperties: boolean;
24
+ required: string[];
25
+ properties: {
26
+ text: {
27
+ type: string;
28
+ contentType: string;
29
+ };
30
+ textSize: {
31
+ type: string;
32
+ enum: string[];
33
+ };
34
+ url: {
35
+ type: string;
36
+ };
37
+ resetMargin: {
38
+ type: string;
39
+ };
40
+ };
41
+ } | {
42
+ type: string;
43
+ })[];
44
+ };
45
+ description: {
46
+ type: string;
47
+ contentType: string;
48
+ };
41
49
  anchor: {
42
50
  type: string;
43
51
  additionalProperties: boolean;
@@ -7,7 +7,7 @@ exports.LinkTableBlock = {
7
7
  'link-table-block': {
8
8
  additionalProperties: false,
9
9
  required: ['items'],
10
- properties: Object.assign(Object.assign({}, common_1.BlockBaseProps), { title: common_1.TitleProps, items: {
10
+ properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.BlockHeaderProps), { items: {
11
11
  type: 'array',
12
12
  items: (0, utils_1.filteredArray)(common_1.LinkProps),
13
13
  } }),
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MediaBlock = exports.Media = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const common_1 = require("../../schema/validators/common");
6
- const schema_1 = require("../../../src/sub-blocks/Content/schema");
6
+ const schema_1 = require("../../sub-blocks/Content/schema");
7
7
  exports.Media = {
8
8
  type: 'object',
9
9
  additionalProperties: false,
@@ -155,6 +155,20 @@ export declare const PromoFeaturesBlock: {
155
155
  additionalProperties: boolean;
156
156
  required: string[];
157
157
  properties: {
158
+ theme: {
159
+ enum: string[];
160
+ };
161
+ items: {
162
+ type: string;
163
+ items: {
164
+ type: string;
165
+ properties: {
166
+ when: {
167
+ type: string;
168
+ };
169
+ };
170
+ };
171
+ };
158
172
  title: {
159
173
  oneOf: ({
160
174
  type: string;
@@ -178,27 +192,12 @@ export declare const PromoFeaturesBlock: {
178
192
  };
179
193
  } | {
180
194
  type: string;
181
- contentType: string;
182
195
  })[];
183
196
  };
184
197
  description: {
185
198
  type: string;
186
199
  contentType: string;
187
200
  };
188
- theme: {
189
- enum: string[];
190
- };
191
- items: {
192
- type: string;
193
- items: {
194
- type: string;
195
- properties: {
196
- when: {
197
- type: string;
198
- };
199
- };
200
- };
201
- };
202
201
  animated: {
203
202
  type: string;
204
203
  };
@@ -26,12 +26,7 @@ exports.PromoFeaturesBlock = {
26
26
  'promo-features-block': {
27
27
  additionalProperties: false,
28
28
  required: ['items'],
29
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), { title: {
30
- oneOf: [{ type: 'string', contentType: 'text' }, common_1.TitleProps],
31
- }, description: {
32
- type: 'string',
33
- contentType: 'text',
34
- }, theme: {
29
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { theme: {
35
30
  enum: ['grey', 'default'],
36
31
  }, items: (0, utils_1.filteredArray)(exports.PromoFeaturesItem) }),
37
32
  },
@@ -1,10 +1,5 @@
1
- import SlickSlider, { Settings } from 'react-slick';
1
+ import { Settings } from 'react-slick';
2
2
  import { Refable, SliderProps as SliderParams, ClassNameProps, WithChildren } from '../../models';
3
- export interface SlickSliderFull extends SlickSlider {
4
- innerSlider?: {
5
- list: HTMLElement;
6
- };
7
- }
8
3
  export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
9
4
  type?: string;
10
5
  anchorId?: string;
@@ -5,31 +5,6 @@ export declare const SliderProps: {
5
5
  arrows: {
6
6
  type: string;
7
7
  };
8
- description: {
9
- type: string;
10
- contentType: string;
11
- };
12
- title: {
13
- type: string;
14
- additionalProperties: boolean;
15
- required: string[];
16
- properties: {
17
- text: {
18
- type: string;
19
- contentType: string;
20
- };
21
- textSize: {
22
- type: string;
23
- enum: string[];
24
- };
25
- url: {
26
- type: string;
27
- };
28
- resetMargin: {
29
- type: string;
30
- };
31
- };
32
- };
33
8
  randomOrder: {
34
9
  type: string;
35
10
  };
@@ -108,36 +83,40 @@ export declare const SliderBlock: {
108
83
  additionalProperties: boolean;
109
84
  required: never[];
110
85
  properties: {
111
- dots: {
112
- type: string;
113
- };
114
- arrows: {
115
- type: string;
86
+ title: {
87
+ oneOf: ({
88
+ type: string;
89
+ additionalProperties: boolean;
90
+ required: string[];
91
+ properties: {
92
+ text: {
93
+ type: string;
94
+ contentType: string;
95
+ };
96
+ textSize: {
97
+ type: string;
98
+ enum: string[];
99
+ };
100
+ url: {
101
+ type: string;
102
+ };
103
+ resetMargin: {
104
+ type: string;
105
+ };
106
+ };
107
+ } | {
108
+ type: string;
109
+ })[];
116
110
  };
117
111
  description: {
118
112
  type: string;
119
113
  contentType: string;
120
114
  };
121
- title: {
115
+ dots: {
116
+ type: string;
117
+ };
118
+ arrows: {
122
119
  type: string;
123
- additionalProperties: boolean;
124
- required: string[];
125
- properties: {
126
- text: {
127
- type: string;
128
- contentType: string;
129
- };
130
- textSize: {
131
- type: string;
132
- enum: string[];
133
- };
134
- url: {
135
- type: string;
136
- };
137
- resetMargin: {
138
- type: string;
139
- };
140
- };
141
120
  };
142
121
  randomOrder: {
143
122
  type: string;
@@ -51,11 +51,6 @@ exports.SliderProps = {
51
51
  arrows: {
52
52
  type: 'boolean',
53
53
  },
54
- description: {
55
- type: 'string',
56
- contentType: 'text',
57
- },
58
- title: common_1.TitleProps,
59
54
  randomOrder: {
60
55
  type: 'boolean',
61
56
  },
@@ -72,6 +67,6 @@ exports.SliderBlock = {
72
67
  'slider-block': {
73
68
  additionalProperties: false,
74
69
  required: [],
75
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), exports.SliderProps),
70
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), exports.SliderProps), common_1.BlockHeaderProps),
76
71
  },
77
72
  };
@@ -272,31 +272,6 @@ export declare const TabsBlock: {
272
272
  additionalProperties: boolean;
273
273
  required: string[];
274
274
  properties: {
275
- title: {
276
- type: string;
277
- additionalProperties: boolean;
278
- required: string[];
279
- properties: {
280
- text: {
281
- type: string;
282
- contentType: string;
283
- };
284
- textSize: {
285
- type: string;
286
- enum: string[];
287
- };
288
- url: {
289
- type: string;
290
- };
291
- resetMargin: {
292
- type: string;
293
- };
294
- };
295
- };
296
- description: {
297
- type: string;
298
- contentType: string;
299
- };
300
275
  tabsColSizes: {};
301
276
  direction: {
302
277
  type: string;
@@ -316,6 +291,35 @@ export declare const TabsBlock: {
316
291
  };
317
292
  };
318
293
  };
294
+ title: {
295
+ oneOf: ({
296
+ type: string;
297
+ additionalProperties: boolean;
298
+ required: string[];
299
+ properties: {
300
+ text: {
301
+ type: string;
302
+ contentType: string;
303
+ };
304
+ textSize: {
305
+ type: string;
306
+ enum: string[];
307
+ };
308
+ url: {
309
+ type: string;
310
+ };
311
+ resetMargin: {
312
+ type: string;
313
+ };
314
+ };
315
+ } | {
316
+ type: string;
317
+ })[];
318
+ };
319
+ description: {
320
+ type: string;
321
+ contentType: string;
322
+ };
319
323
  anchor: {
320
324
  type: string;
321
325
  additionalProperties: boolean;
@@ -28,10 +28,7 @@ exports.TabsBlock = {
28
28
  'tabs-block': {
29
29
  additionalProperties: false,
30
30
  required: ['title', 'items'],
31
- properties: Object.assign(Object.assign({}, common_1.BlockBaseProps), { title: common_1.TitleProps, description: {
32
- type: 'string',
33
- contentType: 'text',
34
- }, tabsColSizes: common_1.containerSizesArray.reduce((acc, size) => (Object.assign(Object.assign({}, acc), { [size]: common_1.sizeNumber })), {}), direction: {
31
+ properties: Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.BlockHeaderProps), { tabsColSizes: common_1.containerSizesArray.reduce((acc, size) => (Object.assign(Object.assign({}, acc), { [size]: common_1.sizeNumber })), {}), direction: {
35
32
  type: 'string',
36
33
  enum: common_1.mediaDirection,
37
34
  }, centered: { type: 'boolean' }, items: (0, utils_1.filteredArray)(exports.tabsItem) }),
@@ -7,10 +7,10 @@ const models_1 = require("../../models");
7
7
  const utils_1 = require("../../utils");
8
8
  const b = (0, utils_1.block)('author');
9
9
  const Author = (props) => {
10
- const { author, className, authorContainerClassName, type = models_1.AuthorType.Column } = props;
10
+ const { author, className, authorContainerClassName, type = models_1.AuthorType.Column, dataQa } = props;
11
11
  const { firstName, secondName, description, avatar } = author;
12
12
  const name = secondName ? `${firstName} ${secondName}` : firstName;
13
- return (react_1.default.createElement("div", { className: b({ type }, className) },
13
+ return (react_1.default.createElement("div", { className: b({ type }, className), "data-qa": dataQa },
14
14
  avatar && (react_1.default.createElement("div", { className: b('avatar', authorContainerClassName) }, typeof avatar === 'string' ? react_1.default.createElement(index_1.Image, { src: avatar }) : avatar)),
15
15
  react_1.default.createElement("div", { className: b('label') },
16
16
  react_1.default.createElement("div", { className: b('name') }, name),
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const react_2 = require("@testing-library/react");
6
+ const models_1 = require("../../../models");
7
+ const Author_1 = tslib_1.__importDefault(require("../Author"));
8
+ const testId = 'author';
9
+ const author = {
10
+ firstName: 'John',
11
+ secondName: 'Doe',
12
+ description: 'Web designer',
13
+ avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
14
+ };
15
+ describe('Author', () => {
16
+ test('Render author by default', async () => {
17
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
18
+ const object = react_2.screen.getByTestId(testId);
19
+ expect(object).toBeInTheDocument();
20
+ });
21
+ test('Has full name', async () => {
22
+ const name = `${author.firstName} ${author.secondName}`;
23
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
24
+ const object = react_2.screen.getByText(name);
25
+ expect(object).toBeInTheDocument();
26
+ });
27
+ test('Has first name only', async () => {
28
+ const name = author.firstName;
29
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
30
+ const object = react_2.screen.getByText(name);
31
+ expect(object).toBeInTheDocument();
32
+ });
33
+ test('Has avatar', async () => {
34
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
35
+ const avatar = react_2.screen.getByRole('img');
36
+ expect(avatar).toBeInTheDocument();
37
+ expect(avatar).toHaveAttribute('src', author.avatar);
38
+ });
39
+ test('Has description', async () => {
40
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
41
+ const object = react_2.screen.getByText(author.description);
42
+ expect(object).toBeInTheDocument();
43
+ });
44
+ test.each(new Array(models_1.AuthorType.Column, models_1.AuthorType.Line))('Render with given "%s" type', (type) => {
45
+ (0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId, type: type }));
46
+ const object = react_2.screen.getByTestId(testId);
47
+ expect(object).toHaveClass(`pc-author_type_${type}`);
48
+ });
49
+ });