@central-design-system/components 3.0.0-alpha.5 → 3.0.0-alpha.6

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 (54) hide show
  1. package/dist/cds.css +1 -1
  2. package/dist/cds.d.ts +51 -48
  3. package/dist/cds.es.js +3816 -3310
  4. package/dist/cds.umd.js +1 -1
  5. package/dist/components/CdsButton/CdsButton.vue.d.ts +1 -0
  6. package/dist/components/CdsCombobox/CdsCombobox.vue.d.ts +18 -18
  7. package/dist/components/CdsDropdown/CdsDropdown.vue.d.ts +18 -18
  8. package/dist/components/CdsGrid/composable/grid.d.ts +2 -1
  9. package/dist/components/CdsMenu/CdsMenu.vue.d.ts +24 -18
  10. package/dist/components/CdsOverlay/CdsOverlay.vue.d.ts +9 -13
  11. package/dist/components/CdsOverlay/composable/locationStrategies.d.ts +3 -0
  12. package/dist/components/CdsPagination/CdsPagination.vue.d.ts +142 -0
  13. package/dist/components/CdsTooltip/CdsTooltip.vue.d.ts +765 -0
  14. package/dist/components/index.d.ts +3 -1
  15. package/dist/composable/dimensions.d.ts +23 -5
  16. package/dist/composable/display.d.ts +56 -0
  17. package/dist/composable/index.d.ts +3 -0
  18. package/dist/composable/overlay.d.ts +1 -1
  19. package/dist/composable/refs.d.ts +6 -0
  20. package/dist/composable/resizeObserver.d.ts +7 -0
  21. package/dist/create.d.ts +21 -0
  22. package/dist/globals.d.ts +2 -0
  23. package/dist/utils/helpers.d.ts +2 -0
  24. package/package.json +1 -2
  25. package/src/scss/themes/index.ts +1 -1
  26. package/dist/types/CdsOptions.d.ts +0 -3
  27. package/src/utils/__test__/helper.test.ts +0 -59
  28. package/src/utils/__test__/mocks/helper.mock.ts +0 -362
  29. package/src/utils/__test__/mocks/propFactory.mock.ts +0 -88
  30. package/src/utils/__test__/propFactory.test.ts +0 -9
  31. package/src/utils/anchor.ts +0 -76
  32. package/src/utils/animation.ts +0 -62
  33. package/src/utils/box.ts +0 -39
  34. package/src/utils/cache.ts +0 -12
  35. package/src/utils/changeCase/__test__/lowerCase.test.ts +0 -12
  36. package/src/utils/changeCase/__test__/mocks/lowerCase.mock.ts +0 -80
  37. package/src/utils/changeCase/__test__/mocks/noCase.mock.ts +0 -131
  38. package/src/utils/changeCase/__test__/mocks/paramCase.mock.ts +0 -39
  39. package/src/utils/changeCase/__test__/mocks/pascalCase.mock.ts +0 -46
  40. package/src/utils/changeCase/__test__/noCase.test.ts +0 -8
  41. package/src/utils/changeCase/__test__/paramCase.test.ts +0 -8
  42. package/src/utils/changeCase/__test__/pascalCase.test.ts +0 -8
  43. package/src/utils/changeCase/lowerCase.ts +0 -56
  44. package/src/utils/changeCase/noCase.ts +0 -45
  45. package/src/utils/changeCase/paramCase.ts +0 -11
  46. package/src/utils/changeCase/pascalCase.ts +0 -24
  47. package/src/utils/date.ts +0 -1106
  48. package/src/utils/dom.ts +0 -24
  49. package/src/utils/getCurrentInstance.ts +0 -43
  50. package/src/utils/getScrollParent.ts +0 -29
  51. package/src/utils/globals.ts +0 -8
  52. package/src/utils/helpers.ts +0 -312
  53. package/src/utils/index.ts +0 -19
  54. package/src/utils/propsFactory.ts +0 -92
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Automatically generated by CDS CLI
3
- * Generated on 5/23/2023, 3:10:54 PM
3
+ * Generated on 6/1/2023, 2:01:09 PM
4
4
  **/
5
5
  export { default as CdsBadge } from './CdsBadge/CdsBadge.vue';
6
6
  export { default as CdsBreadcrumbs } from './CdsBreadcrumbs/CdsBreadcrumbs.vue';
@@ -30,6 +30,7 @@ export { default as CdsListItem } from './CdsList/CdsListItem.vue';
30
30
  export { default as CdsLoader } from './CdsLoader/CdsLoader.vue';
31
31
  export { default as CdsMenu } from './CdsMenu/CdsMenu.vue';
32
32
  export { default as CdsOverlay } from './CdsOverlay/CdsOverlay.vue';
33
+ export { default as CdsPagination } from './CdsPagination/CdsPagination.vue';
33
34
  export { default as CdsRadio } from './CdsRadioButton/CdsRadio.vue';
34
35
  export { default as CdsRadioButton } from './CdsRadioButton/CdsRadioButton.vue';
35
36
  export { default as CdsSelect } from './CdsSelect/CdsSelect.vue';
@@ -40,3 +41,4 @@ export { default as CdsTag } from './CdsTag/CdsTag.vue';
40
41
  export { default as CdsTextArea } from './CdsTextArea/CdsTextArea.vue';
41
42
  export { default as CdsTextInput } from './CdsTextInput/CdsTextInput.vue';
42
43
  export { default as CdsTimePicker } from './CdsTimePicker/CdsTimePicker.vue';
44
+ export { default as CdsTooltip } from './CdsTooltip/CdsTooltip.vue';
@@ -13,35 +13,53 @@ export interface IUseDimensions {
13
13
  }
14
14
  export declare const makeDimensionProps: <Defaults extends {
15
15
  height?: unknown;
16
+ width?: unknown;
16
17
  maxHeight?: unknown;
17
18
  maxWidth?: unknown;
18
19
  minHeight?: unknown;
19
20
  minWidth?: unknown;
20
- width?: unknown;
21
21
  } = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
22
+ /**
23
+ * Высота
24
+ */
22
25
  height: {
23
26
  type: PropType<string | number>;
24
27
  default: string;
25
28
  };
29
+ /**
30
+ * Ширина
31
+ */
32
+ width: {
33
+ type: PropType<string | number>;
34
+ default: string;
35
+ };
36
+ /**
37
+ * Максимальная высота
38
+ */
26
39
  maxHeight: {
27
40
  type: PropType<string | number>;
28
41
  default: string;
29
42
  };
43
+ /**
44
+ * Максимальная ширина
45
+ */
30
46
  maxWidth: {
31
47
  type: PropType<string | number>;
32
48
  default: string;
33
49
  };
50
+ /**
51
+ * Минимальная высота
52
+ */
34
53
  minHeight: {
35
54
  type: PropType<string | number>;
36
55
  default: string;
37
56
  };
57
+ /**
58
+ * Минимальная ширина
59
+ */
38
60
  minWidth: {
39
61
  type: PropType<string | number>;
40
62
  default: string;
41
63
  };
42
- width: {
43
- type: PropType<string | number>;
44
- default: string;
45
- };
46
64
  }, Defaults>;
47
65
  export declare function useDimensions(props: IDimensionsProps): IUseDimensions;
@@ -0,0 +1,56 @@
1
+ import type { InjectionKey, Ref } from 'vue';
2
+ export declare const breakpoints: readonly ["xs", "sm", "md", "lg", "xl"];
3
+ export declare type TBreakpoint = typeof breakpoints[number];
4
+ export interface IDisplayOptions {
5
+ mobileBreakpoint?: number | TBreakpoint;
6
+ thresholds?: Partial<TDisplayThresholds>;
7
+ }
8
+ export interface IDisplayInstance {
9
+ name: Ref<TBreakpoint>;
10
+ xs: Ref<boolean>;
11
+ sm: Ref<boolean>;
12
+ md: Ref<boolean>;
13
+ lg: Ref<boolean>;
14
+ xl: Ref<boolean>;
15
+ smUp: Ref<boolean>;
16
+ mdUp: Ref<boolean>;
17
+ lgUp: Ref<boolean>;
18
+ xlUp: Ref<boolean>;
19
+ smDown: Ref<boolean>;
20
+ mdDown: Ref<boolean>;
21
+ lgDown: Ref<boolean>;
22
+ xlDown: Ref<boolean>;
23
+ mobile: Ref<boolean>;
24
+ mobileBreakpoint: Ref<number | TBreakpoint>;
25
+ width: Ref<number>;
26
+ height: Ref<number>;
27
+ platform: Ref<TDisplayPlatform>;
28
+ thresholds: Ref<TDisplayThresholds>;
29
+ ssr: boolean;
30
+ update(): void;
31
+ }
32
+ export declare type TDisplayThresholds = {
33
+ [key in TBreakpoint]: number;
34
+ };
35
+ export declare type TDisplayPlatform = {
36
+ android: boolean;
37
+ ios: boolean;
38
+ cordova: boolean;
39
+ electron: boolean;
40
+ chrome: boolean;
41
+ edge: boolean;
42
+ firefox: boolean;
43
+ opera: boolean;
44
+ win: boolean;
45
+ mac: boolean;
46
+ linux: boolean;
47
+ touch: boolean;
48
+ ssr: boolean;
49
+ };
50
+ export declare type TSSROptions = boolean | {
51
+ clientWidth: number;
52
+ clientHeight?: number;
53
+ };
54
+ export declare const DisplaySymbol: InjectionKey<IDisplayInstance>;
55
+ export declare function createDisplay(options?: IDisplayOptions, ssr?: TSSROptions): IDisplayInstance;
56
+ export declare function useDisplay(): IDisplayInstance;
@@ -34,3 +34,6 @@ export * from './select';
34
34
  export * from './filter';
35
35
  export * from './menu';
36
36
  export * from './datetime';
37
+ export * from './resizeObserver';
38
+ export * from './refs';
39
+ export * from './display';
@@ -75,7 +75,7 @@ export declare const makeOverlayProps: <Defaults extends {
75
75
  default: boolean;
76
76
  };
77
77
  /**
78
- * Значение z-index для оверлея
78
+ * Значение z-index
79
79
  */
80
80
  zIndex: {
81
81
  type: PropType<string | number>;
@@ -0,0 +1,6 @@
1
+ import type { Ref } from 'vue';
2
+ export interface IUseRefs<T extends {}> {
3
+ refs: Ref<(T | undefined)[]>;
4
+ updateRef: (value: any, index: number) => void;
5
+ }
6
+ export declare function useRefs<T extends {}>(): IUseRefs<T>;
@@ -0,0 +1,7 @@
1
+ import type { DeepReadonly, Ref } from 'vue';
2
+ interface IUseResizeObserver {
3
+ resizeRef: Ref<HTMLElement | undefined>;
4
+ contentRect: DeepReadonly<Ref<DOMRectReadOnly | undefined>>;
5
+ }
6
+ export declare function useResizeObserver(callback?: ResizeObserverCallback): IUseResizeObserver;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { App } from 'vue';
2
+ import type { IDisplayOptions } from './composable';
3
+ export interface ICdsOptions {
4
+ components?: Record<string, any>;
5
+ directives?: Record<string, any>;
6
+ icons?: Record<string, any>;
7
+ illustrations?: Record<string, any>;
8
+ display?: IDisplayOptions;
9
+ cssGrid?: boolean;
10
+ ssr?: boolean;
11
+ }
12
+ interface NuxtApp {
13
+ $nuxt?: {
14
+ hook: (name: string, fn: () => void) => void;
15
+ };
16
+ }
17
+ export declare function createCds(options?: ICdsOptions): {
18
+ install: (app: App & NuxtApp) => void;
19
+ display: import("./composable").IDisplayInstance;
20
+ };
21
+ export {};
package/dist/globals.d.ts CHANGED
@@ -13,4 +13,6 @@ declare global {
13
13
  | undefined
14
14
  > & { lastMousedownWasOutside: boolean };
15
15
  }
16
+
17
+ export const __VUE_OPTIONS_API__: boolean | undefined;
16
18
  }
@@ -101,6 +101,7 @@ export declare function convertToUnit(str: string | number | null | undefined, u
101
101
  * @param max
102
102
  */
103
103
  export declare function clamp(value: number, min?: number, max?: number): number;
104
+ export declare function createRange(length: number, start?: number): number[];
104
105
  /**
105
106
  * Is value an like event
106
107
  * @param key
@@ -111,6 +112,7 @@ export declare function isComponentInstance(obj: any): obj is ComponentPublicIns
111
112
  export declare function isFixedPosition(el?: HTMLElement): boolean;
112
113
  export declare function padStart(string: number | string, targetLength: number, padString: string): string;
113
114
  export declare function pad(n: string | number, length?: number): string;
115
+ export declare function refElement<T extends Record<string, any> | undefined>(obj: T): Exclude<T, ComponentPublicInstance> | HTMLElement;
114
116
  /**
115
117
  * Types
116
118
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@central-design-system/components",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.6",
4
4
  "description": "Central Design System on the Vue 3.0 and TypeScript",
5
5
  "author": "magersoft",
6
6
  "license": "ISC",
@@ -19,7 +19,6 @@
19
19
  },
20
20
  "files": [
21
21
  "dist",
22
- "src/utils",
23
22
  "src/scss",
24
23
  "nuxt.js"
25
24
  ],
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Automatically generated by CDS CLI
3
- * Generated on 5/26/2023, 3:51:24 PM
3
+ * Generated on 6/1/2023, 2:19:29 PM
4
4
  **/
5
5
 
6
6
  /**
@@ -1,3 +0,0 @@
1
- export interface ICdsOptions {
2
- cssGrid?: boolean;
3
- }
@@ -1,59 +0,0 @@
1
- import { pick, isObject, mergeDeep, getNestedValue, getObjectValueByPath, getPropertyFromItem } from '../helpers';
2
- import {
3
- mockHelpersIsObject,
4
- mockHelpersMergeDeep,
5
- mockHelpersGetNestedValue,
6
- mockHelpersGetObjectValueByPath,
7
- mockHelpersGetPropertyFromItem,
8
- mockHelpersPick
9
- } from './mocks/helper.mock';
10
-
11
- describe('isObject', () => {
12
- mockHelpersIsObject.forEach(({ name, initial, expected }) => {
13
- it(name, () => {
14
- expect(isObject(initial)).toEqual(expected);
15
- });
16
- });
17
- });
18
-
19
- describe('mergeDeep', () => {
20
- mockHelpersMergeDeep.forEach(({ name, initial, expected }) => {
21
- it(name, () => {
22
- expect(mergeDeep(initial.source, initial.target, initial.arrayFn)).toEqual(expected);
23
- });
24
- });
25
- });
26
-
27
- describe('getNestedValue', () => {
28
- mockHelpersGetNestedValue.forEach(({ name, initial, expected }) => {
29
- it(name, () => {
30
- expect(getNestedValue(initial.obj, initial.path, initial.fallback)).toEqual(expected);
31
- });
32
- });
33
- });
34
-
35
- describe('getObjectValueByPath', () => {
36
- mockHelpersGetObjectValueByPath.forEach(({ name, initial, expected }) => {
37
- it(name, () => {
38
- expect(getObjectValueByPath(initial.obj, initial.path, initial.fallback)).toEqual(expected);
39
- });
40
- });
41
- });
42
-
43
- describe('getPropertyFromItem', () => {
44
- mockHelpersGetPropertyFromItem.forEach(({ name, initial, expected }) => {
45
- it(name, () => {
46
- expect(getPropertyFromItem(initial.item, initial.property, initial.fallback)).toEqual(expected);
47
- });
48
- });
49
- });
50
-
51
- describe('pick', () => {
52
- mockHelpersPick.forEach(({ name, initial, expected }) => {
53
- it(name, () => {
54
- const [yes, no] = pick(initial.obj, initial.paths);
55
- expect(yes).toEqual(expected.yes);
56
- expect(no).toEqual(expected.no);
57
- });
58
- });
59
- });
@@ -1,362 +0,0 @@
1
- import type { IMockDataProvider } from '@/types/vitest';
2
- import type { SelectItemKey } from '@components/utils';
3
-
4
- export const mockHelpersIsObject: IMockDataProvider[] = [
5
- {
6
- name: 'returns true for objects',
7
- initial: {},
8
- expected: true
9
- },
10
- {
11
- name: 'returns true for objects with value',
12
- initial: { a: 'foo' },
13
- expected: true
14
- },
15
- {
16
- name: 'returns false for null',
17
- initial: null,
18
- expected: false
19
- },
20
- {
21
- name: 'returns false for undefined',
22
- initial: undefined,
23
- expected: false
24
- },
25
- {
26
- name: 'returns false for empty array',
27
- initial: [],
28
- expected: false
29
- },
30
- {
31
- name: 'returns false for string',
32
- initial: 'str',
33
- expected: false
34
- },
35
- {
36
- name: 'returns false for number',
37
- initial: 42,
38
- expected: false
39
- },
40
- {
41
- name: 'returns false for boolean',
42
- initial: true,
43
- expected: false
44
- },
45
- {
46
- name: 'returns false for function',
47
- initial: () => {},
48
- expected: false
49
- }
50
- ];
51
-
52
- type TMockHelpersMergeDeepInitial = {
53
- source?: Record<string, any>;
54
- target?: Record<string, any>;
55
- arrayFn?: (a: unknown[], b: unknown[]) => unknown[];
56
- };
57
- export const mockHelpersMergeDeep: IMockDataProvider<TMockHelpersMergeDeepInitial>[] = [
58
- {
59
- name: 'should be merges empty objects',
60
- initial: {},
61
- expected: {}
62
- },
63
- {
64
- name: 'should be merges simple objects',
65
- initial: {
66
- source: { a: 'foo' },
67
- target: { b: 'bar' }
68
- },
69
- expected: {
70
- a: 'foo',
71
- b: 'bar'
72
- }
73
- },
74
- {
75
- name: 'should be deeply merges nested objects',
76
- initial: {
77
- source: {
78
- a: {
79
- b: {
80
- c: 'foo'
81
- }
82
- }
83
- },
84
- target: {
85
- a: {
86
- b: {
87
- c: 'foo',
88
- d: 'bar'
89
- }
90
- }
91
- }
92
- },
93
- expected: {
94
- a: {
95
- b: {
96
- c: 'foo',
97
- d: 'bar'
98
- }
99
- }
100
- }
101
- },
102
- {
103
- name: 'should be uses custom arrayFn to merge arrays',
104
- initial: {
105
- source: {
106
- a: [
107
- {
108
- a: 'foo'
109
- }
110
- ]
111
- },
112
- target: {
113
- a: [
114
- {
115
- b: 'bar'
116
- }
117
- ]
118
- },
119
- arrayFn: (a, b) => a.concat(b)
120
- },
121
- expected: {
122
- a: [{ a: 'foo' }, { b: 'bar' }]
123
- }
124
- }
125
- ];
126
-
127
- type TMockHelpersGetNestedValueInitial = {
128
- obj?: Record<string, any>;
129
- path: (string | number)[];
130
- fallback?: any;
131
- };
132
- export const mockHelpersGetNestedValue: IMockDataProvider<TMockHelpersGetNestedValueInitial>[] = [
133
- {
134
- name: 'should return nested value when path is valid',
135
- initial: {
136
- obj: { a: { b: { c: 'x' } } },
137
- path: ['a', 'b', 'c']
138
- },
139
- expected: 'x'
140
- },
141
- {
142
- name: 'should return fallback when path is invalid',
143
- initial: {
144
- obj: { a: 'x' },
145
- path: ['a', 'b', 'd'],
146
- fallback: 'y'
147
- },
148
- expected: 'y'
149
- },
150
- {
151
- name: 'should return fallback when obj is undefined',
152
- initial: {
153
- obj: undefined,
154
- path: ['a', 'b', 'd'],
155
- fallback: 'y'
156
- },
157
- expected: 'y'
158
- },
159
- {
160
- name: 'should return obj when path is empty array',
161
- initial: {
162
- obj: {},
163
- path: []
164
- },
165
- expected: {}
166
- },
167
- {
168
- name: 'should return obj with fallback if provided and path is empty array',
169
- initial: {
170
- obj: undefined,
171
- path: [],
172
- fallback: 'y'
173
- },
174
- expected: 'y'
175
- }
176
- ];
177
-
178
- type TMockHelpersGetObjectValueByPathInitial = {
179
- obj?: Record<string, any> | any;
180
- path: string;
181
- fallback?: any;
182
- };
183
- export const mockHelpersGetObjectValueByPath: IMockDataProvider<TMockHelpersGetObjectValueByPathInitial>[] = [
184
- {
185
- name: 'should return nested value when path is valid',
186
- initial: {
187
- obj: { a: { b: { c: 'x' } } },
188
- path: 'a.b.c'
189
- },
190
- expected: 'x'
191
- },
192
- {
193
- name: 'should handles indexed arrays',
194
- initial: {
195
- obj: { users: [{ name: 'Jane' }, { name: 'John' }] },
196
- path: 'users[1].name'
197
- },
198
- expected: 'John'
199
- },
200
- {
201
- name: 'should return fallback when path is invalid',
202
- initial: {
203
- obj: { a: 'x' },
204
- path: 'a.b.d'
205
- },
206
- expected: undefined
207
- },
208
- {
209
- name: 'should return fallback when obj is undefined',
210
- initial: {
211
- obj: undefined,
212
- path: 'a.b.d',
213
- fallback: 'y'
214
- },
215
- expected: 'y'
216
- },
217
- {
218
- name: 'should return undefined when path is empty string',
219
- initial: {
220
- obj: {},
221
- path: ''
222
- },
223
- expected: undefined
224
- },
225
- {
226
- name: 'should return obj with fallback if provided and path is empty string',
227
- initial: {
228
- obj: undefined,
229
- path: '',
230
- fallback: 'y'
231
- },
232
- expected: 'y'
233
- },
234
- {
235
- name: "should return obj[path] if it isn't undefined",
236
- initial: {
237
- obj: { firstKey: 'value' },
238
- path: 'firstKey',
239
- fallback: 'fallbackValue'
240
- },
241
- expected: 'value'
242
- },
243
- {
244
- name: 'should return fallback in case of invalid input data',
245
- initial: {
246
- obj: null,
247
- path: null as any,
248
- fallback: 5
249
- },
250
- expected: 5
251
- }
252
- ];
253
-
254
- type TMockHelpersGetPropertyFromItem = {
255
- item: any;
256
- property: SelectItemKey;
257
- fallback?: any;
258
- };
259
- export const mockHelpersGetPropertyFromItem: IMockDataProvider<TMockHelpersGetPropertyFromItem>[] = [
260
- {
261
- name: 'should return the item if property is null',
262
- initial: {
263
- item: 'item',
264
- property: null as any,
265
- fallback: 'fallback'
266
- },
267
- expected: 'item'
268
- },
269
- {
270
- name: 'should return the item if property is undefined',
271
- initial: {
272
- item: undefined,
273
- property: null as any,
274
- fallback: 'fallback'
275
- },
276
- expected: 'fallback'
277
- },
278
- {
279
- name: 'should return the fallback if item is not an object',
280
- initial: {
281
- item: 1,
282
- property: 'path',
283
- fallback: 'fallback'
284
- },
285
- expected: 'fallback'
286
- },
287
- {
288
- name: 'should return the correct value for a string property',
289
- initial: {
290
- item: { path: 'value' },
291
- property: 'path'
292
- },
293
- expected: 'value'
294
- },
295
- {
296
- name: 'should return the correct value for an array property and fallback when not found',
297
- initial: {
298
- item: { path: { subpath: 'value' } },
299
- property: ['path', 'subpath'],
300
- fallback: 'fallback'
301
- },
302
- expected: 'value'
303
- },
304
- {
305
- name: 'should return the correct value for a function property',
306
- initial: {
307
- item: { path: 'value' },
308
- property: (item: any) => item.path,
309
- fallback: 'fallback'
310
- },
311
- expected: 'value'
312
- },
313
- {
314
- name: 'should return the fallback if the function returns undefined',
315
- initial: {
316
- item: { path: 'value' },
317
- property: () => undefined,
318
- fallback: 'fallback'
319
- },
320
- expected: 'fallback'
321
- }
322
- ];
323
-
324
- type TMockHelpersPick = {
325
- obj: Record<string, any>;
326
- paths: string[] | RegExp[] | any[];
327
- };
328
- export const mockHelpersPick: IMockDataProvider<TMockHelpersPick>[] = [
329
- {
330
- name: 'should correctly selects specified properties and returns both picked and unpicked objects',
331
- initial: {
332
- obj: { a: 1, b: 2, c: 3 },
333
- paths: ['a', 'c']
334
- },
335
- expected: {
336
- yes: { a: 1, c: 3 },
337
- no: { b: 2 }
338
- }
339
- },
340
- {
341
- name: 'should correctly selects specified properties using regex',
342
- initial: {
343
- obj: { a: 1, b: 2, c: 3 },
344
- paths: [/^[ab]$/]
345
- },
346
- expected: {
347
- yes: { a: 1, b: 2 },
348
- no: { c: 3 }
349
- }
350
- },
351
- {
352
- name: 'should returns empty objects for non-existing properties',
353
- initial: {
354
- obj: { a: 1, b: 2, c: 3 },
355
- paths: ['x', 'y', 'z']
356
- },
357
- expected: {
358
- yes: {},
359
- no: { a: 1, b: 2, c: 3 }
360
- }
361
- }
362
- ];