@datarailsshared/dr_renderer 1.5.159 → 1.5.168
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/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/misc.xml +9 -0
- package/.nvmrc +1 -0
- package/jest.config.js +1 -1
- package/package.json +9 -11
- package/scripts/check-versions.js +16 -0
- package/src/highcharts_renderer.d.ts +2 -2
- package/tsconfig.json +1 -1
- package/.circleci/config.yml +0 -85
- package/.github/workflows/ai-coder-jira.yml +0 -915
- package/.github/workflows/ai-coder-n8n-caller.yml +0 -82
- package/.github/workflows/release.yml +0 -49
- package/tests/__snapshots__/suboptions.test.js.snap +0 -5028
- package/tests/dr-renderer-helpers.test.js +0 -228
- package/tests/dr_chart_tooltip.test.js +0 -789
- package/tests/dr_gauge_chart.test.js +0 -2041
- package/tests/errors.test.js +0 -157
- package/tests/highcharts_renderer.test.js +0 -9407
- package/tests/mock/add-in-dynamic-ranges.json +0 -127
- package/tests/mock/add-in-functions.json +0 -410
- package/tests/mock/add-in-tables.json +0 -347
- package/tests/mock/tables.json +0 -2258
- package/tests/mock/widgets.json +0 -401
- package/tests/options-builder.test.js +0 -1698
- package/tests/pivot-table/freeze-panes/constants.test.js +0 -92
- package/tests/pivot-table/freeze-panes/index.test.js +0 -193
- package/tests/pivot-table/freeze-panes/sticky-strategy.test.js +0 -542
- package/tests/pivot-table/freeze-panes/transform-strategy.test.js +0 -304
- package/tests/ptCreateDrillDownSeriesToDrilldownChart.test.js +0 -509
- package/tests/seriesPointStyles-helper.test.js +0 -114
- package/tests/suboptions.test.js +0 -322
- package/tests/value.formatter.test.js +0 -143
|
@@ -1,1698 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Unit tests for the options builder module.
|
|
3
|
-
*
|
|
4
|
-
* Tests the standalone options builder module components:
|
|
5
|
-
* - Constants
|
|
6
|
-
* - Element factories
|
|
7
|
-
* - Builders
|
|
8
|
-
* - Presets
|
|
9
|
-
* - Helpers
|
|
10
|
-
* - Index exports
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const options = require('../src/options');
|
|
14
|
-
|
|
15
|
-
// Destructure for easier testing
|
|
16
|
-
const {
|
|
17
|
-
// Constants
|
|
18
|
-
CHART_TYPES,
|
|
19
|
-
CHART_COLORS,
|
|
20
|
-
SUBOPTIONS_FONTS,
|
|
21
|
-
HIGHCHARTS_FONT_FAMILY,
|
|
22
|
-
HIGHCHARTS_FONT_FAMILY_CSS,
|
|
23
|
-
TOOLTIP_DEFAULT_SETTINGS,
|
|
24
|
-
TOOLTIP_DEFAULT_OPTIONS,
|
|
25
|
-
LABEL_DEFAULT_SETTINGS,
|
|
26
|
-
LABEL_DEFAULT_OPTIONS,
|
|
27
|
-
SUBOPTIONS_FONT_SIZE_VALUES,
|
|
28
|
-
DEFAULT_CATEGORY_CLASS,
|
|
29
|
-
|
|
30
|
-
// Element factories
|
|
31
|
-
createToggle,
|
|
32
|
-
createCheckbox,
|
|
33
|
-
createInput,
|
|
34
|
-
createSelect,
|
|
35
|
-
createRadio,
|
|
36
|
-
createColorPicker,
|
|
37
|
-
createDivider,
|
|
38
|
-
createTextarea,
|
|
39
|
-
createTag,
|
|
40
|
-
createFontStylingGroup,
|
|
41
|
-
createLabelStyleGroup,
|
|
42
|
-
createTooltipStyleGroup,
|
|
43
|
-
|
|
44
|
-
// Builders
|
|
45
|
-
withLabel,
|
|
46
|
-
withLabelPie,
|
|
47
|
-
withLabelGauge,
|
|
48
|
-
withLabelWithPercentage,
|
|
49
|
-
withLabelWithPercentagePercentStacked,
|
|
50
|
-
withTooltip,
|
|
51
|
-
withTooltipPie,
|
|
52
|
-
withTooltipGauge,
|
|
53
|
-
withAxisY,
|
|
54
|
-
withAxisYPercentStacked,
|
|
55
|
-
withAxisX,
|
|
56
|
-
withTableOptions,
|
|
57
|
-
withTableOptionsTranspose,
|
|
58
|
-
withTableOptionsGauge,
|
|
59
|
-
withTableDesignOptions,
|
|
60
|
-
withChart,
|
|
61
|
-
withChartGrid,
|
|
62
|
-
withChartForecast,
|
|
63
|
-
withChartPosition,
|
|
64
|
-
withWidgetLibrary,
|
|
65
|
-
withSubtitle,
|
|
66
|
-
withName,
|
|
67
|
-
withNegativeNumberFormat,
|
|
68
|
-
withValue,
|
|
69
|
-
withRange,
|
|
70
|
-
withTicks,
|
|
71
|
-
withLegends,
|
|
72
|
-
withDeltaColumn,
|
|
73
|
-
withDeltaColumnForDrillDown,
|
|
74
|
-
withAdvanced,
|
|
75
|
-
withTotalValueLabelDonut,
|
|
76
|
-
withGaugeGoal,
|
|
77
|
-
withGaugeSegments,
|
|
78
|
-
withGaugeIsAbsolute,
|
|
79
|
-
|
|
80
|
-
// Presets
|
|
81
|
-
CHART_PRESETS,
|
|
82
|
-
BUILDER_KEY_MAP,
|
|
83
|
-
getBuilderKey,
|
|
84
|
-
getPresetForChart,
|
|
85
|
-
buildSuboptionsForChart,
|
|
86
|
-
buildSuboptions,
|
|
87
|
-
getChartTypes,
|
|
88
|
-
hasPreset,
|
|
89
|
-
|
|
90
|
-
// Helpers
|
|
91
|
-
chartHasVerticalDataLabelsOption,
|
|
92
|
-
|
|
93
|
-
// Disabled conditions
|
|
94
|
-
LABEL_DISABLED_CONDITION,
|
|
95
|
-
LABEL_PIE_DISABLED_CONDITION,
|
|
96
|
-
TOOLTIP_DISABLED_CONDITION,
|
|
97
|
-
TOOLTIP_PIE_DISABLED_CONDITION,
|
|
98
|
-
|
|
99
|
-
// Reusable elements
|
|
100
|
-
LABEL_SHOW_TOGGLE,
|
|
101
|
-
LABEL_PIE_SHOW_TOGGLE,
|
|
102
|
-
LABEL_OVERLAP_TOGGLE,
|
|
103
|
-
TOOLTIP_SHOW_TOGGLE,
|
|
104
|
-
TOOLTIP_PIE_SHOW_TOGGLE,
|
|
105
|
-
GAUGE_SHOW_TOGGLE,
|
|
106
|
-
|
|
107
|
-
// Factory
|
|
108
|
-
createDefaultSuboptions,
|
|
109
|
-
} = options;
|
|
110
|
-
|
|
111
|
-
describe('Options Builder Module', () => {
|
|
112
|
-
|
|
113
|
-
// =========================================================================
|
|
114
|
-
// Constants Tests
|
|
115
|
-
// =========================================================================
|
|
116
|
-
|
|
117
|
-
describe('Constants', () => {
|
|
118
|
-
describe('CHART_TYPES', () => {
|
|
119
|
-
it('should contain all expected chart types', () => {
|
|
120
|
-
expect(CHART_TYPES.LINE_CHART).toBe('line-chart');
|
|
121
|
-
expect(CHART_TYPES.LINE_CHART_SMOOTH).toBe('line-chart-smooth');
|
|
122
|
-
expect(CHART_TYPES.LINE_CHART_FORECAST).toBe('line-chart-forecast');
|
|
123
|
-
expect(CHART_TYPES.COLUMN_CHART).toBe('column-chart');
|
|
124
|
-
expect(CHART_TYPES.COLUMN_CHART_STACKED).toBe('column-chart-stacked');
|
|
125
|
-
expect(CHART_TYPES.COLUMN_CHART_STACKED_PERCENT).toBe('column-chart-stacked-percent');
|
|
126
|
-
expect(CHART_TYPES.COMBO_CHART).toBe('combo-chart');
|
|
127
|
-
expect(CHART_TYPES.COMBO_COLUMN_CHART).toBe('combo-column-chart');
|
|
128
|
-
expect(CHART_TYPES.COMBO_STACKED_CHART).toBe('combo-stacked-chart');
|
|
129
|
-
expect(CHART_TYPES.BAR_CHART).toBe('bar-chart');
|
|
130
|
-
expect(CHART_TYPES.BAR_CHART_STACKED).toBe('bar-chart-stacked');
|
|
131
|
-
expect(CHART_TYPES.BAR_CHART_STACKED_PERCENT).toBe('bar-chart-stacked-percent');
|
|
132
|
-
expect(CHART_TYPES.SCATTER_CHART).toBe('scatter-chart');
|
|
133
|
-
expect(CHART_TYPES.AREA_CHART).toBe('area-chart');
|
|
134
|
-
expect(CHART_TYPES.AREA_CHART_SMOOTH).toBe('area-chart-smooth');
|
|
135
|
-
expect(CHART_TYPES.TABLE_ONLY).toBe('table_only');
|
|
136
|
-
expect(CHART_TYPES.POLYGON_CHART).toBe('polygon-chart');
|
|
137
|
-
expect(CHART_TYPES.PIE_CHART).toBe('pie-chart');
|
|
138
|
-
expect(CHART_TYPES.PIE_CHART_DRILLDOWN).toBe('pie-chart-drilldown');
|
|
139
|
-
expect(CHART_TYPES.GAUGE_CHART_ENHANCED).toBe('gauge-chart-enhanced');
|
|
140
|
-
expect(CHART_TYPES.GAUGE_CHART_DYNAMIC_GOAL).toBe('gauge-chart-dynamic-goal');
|
|
141
|
-
expect(CHART_TYPES.GAUGE_CHART_CATEGORIES_SUMMARY).toBe('gauge-chart-categories-summary');
|
|
142
|
-
expect(CHART_TYPES.KPI_WIDGET).toBe('kpi-widget');
|
|
143
|
-
expect(CHART_TYPES.SMART_KPI).toBe('smart-kpi');
|
|
144
|
-
expect(CHART_TYPES.TEXT_WIDGET).toBe('text-widget');
|
|
145
|
-
expect(CHART_TYPES.WATERFALL_BREAKDOWN).toBe('waterfall-chart-breakdown');
|
|
146
|
-
expect(CHART_TYPES.WATERFALL_WALKTHROUGH).toBe('waterfall-chart-walkthrough');
|
|
147
|
-
expect(CHART_TYPES.DONUT_CHART).toBe('donut-chart');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('should have all values as strings', () => {
|
|
151
|
-
Object.values(CHART_TYPES).forEach(value => {
|
|
152
|
-
expect(typeof value).toBe('string');
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
describe('CHART_COLORS', () => {
|
|
158
|
-
it('should contain expected color keys', () => {
|
|
159
|
-
expect(CHART_COLORS.BACKGROUND).toBeDefined();
|
|
160
|
-
expect(CHART_COLORS.TEXT).toBeDefined();
|
|
161
|
-
expect(CHART_COLORS.LABEL).toBeDefined();
|
|
162
|
-
expect(CHART_COLORS.TICK_COLOR).toBeDefined();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('should have valid color values', () => {
|
|
166
|
-
// All values should be strings (hex, rgba, or named colors)
|
|
167
|
-
Object.values(CHART_COLORS).forEach(value => {
|
|
168
|
-
expect(typeof value).toBe('string');
|
|
169
|
-
// Should be hex, rgba, or valid color name
|
|
170
|
-
expect(value).toMatch(/^(#|rgba|white|black|red|green|blue)/);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe('SUBOPTIONS_FONTS', () => {
|
|
176
|
-
it('should be an array of font names', () => {
|
|
177
|
-
expect(Array.isArray(SUBOPTIONS_FONTS)).toBe(true);
|
|
178
|
-
expect(SUBOPTIONS_FONTS.length).toBeGreaterThan(0);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('should contain common fonts', () => {
|
|
182
|
-
expect(SUBOPTIONS_FONTS).toContain('Arial');
|
|
183
|
-
expect(SUBOPTIONS_FONTS).toContain('Poppins');
|
|
184
|
-
expect(SUBOPTIONS_FONTS).toContain('Helvetica');
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
describe('SUBOPTIONS_FONT_SIZE_VALUES', () => {
|
|
189
|
-
it('should contain 19 font size options (6-24)', () => {
|
|
190
|
-
expect(SUBOPTIONS_FONT_SIZE_VALUES).toHaveLength(19);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('should have correct structure for each option', () => {
|
|
194
|
-
SUBOPTIONS_FONT_SIZE_VALUES.forEach(option => {
|
|
195
|
-
expect(option).toHaveProperty('label');
|
|
196
|
-
expect(option).toHaveProperty('value');
|
|
197
|
-
expect(option.label).toBe(option.value);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('should start at 6 and end at 24', () => {
|
|
202
|
-
expect(SUBOPTIONS_FONT_SIZE_VALUES[0].value).toBe(6);
|
|
203
|
-
expect(SUBOPTIONS_FONT_SIZE_VALUES[18].value).toBe(24);
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
describe('DEFAULT_CATEGORY_CLASS', () => {
|
|
208
|
-
it('should be the correct CSS class', () => {
|
|
209
|
-
expect(DEFAULT_CATEGORY_CLASS).toBe('google-visualization-charteditor-mini-more');
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
describe('HIGHCHARTS_FONT_FAMILY', () => {
|
|
214
|
-
it('should be Poppins', () => {
|
|
215
|
-
expect(HIGHCHARTS_FONT_FAMILY).toBe('Poppins');
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
describe('HIGHCHARTS_FONT_FAMILY_CSS', () => {
|
|
220
|
-
it('should include fallback', () => {
|
|
221
|
-
expect(HIGHCHARTS_FONT_FAMILY_CSS).toBe('Poppins, sans-serif');
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
describe('LABEL_DEFAULT_SETTINGS', () => {
|
|
226
|
-
it('should have correct structure', () => {
|
|
227
|
-
expect(LABEL_DEFAULT_SETTINGS).toHaveProperty('FONT_COLOR');
|
|
228
|
-
expect(LABEL_DEFAULT_SETTINGS).toHaveProperty('FONT_SIZE');
|
|
229
|
-
expect(LABEL_DEFAULT_SETTINGS).toHaveProperty('FONT_FAMILY');
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('should have correct default values', () => {
|
|
233
|
-
expect(LABEL_DEFAULT_SETTINGS.FONT_FAMILY).toBe('Poppins');
|
|
234
|
-
expect(LABEL_DEFAULT_SETTINGS.FONT_SIZE).toBe('11');
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
describe('TOOLTIP_DEFAULT_SETTINGS', () => {
|
|
239
|
-
it('should have correct structure', () => {
|
|
240
|
-
expect(TOOLTIP_DEFAULT_SETTINGS).toHaveProperty('FONT_COLOR');
|
|
241
|
-
expect(TOOLTIP_DEFAULT_SETTINGS).toHaveProperty('FONT_SIZE');
|
|
242
|
-
expect(TOOLTIP_DEFAULT_SETTINGS).toHaveProperty('FONT_FAMILY');
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('should have correct default values', () => {
|
|
246
|
-
expect(TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY).toBe('Poppins');
|
|
247
|
-
expect(TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE).toBe('12');
|
|
248
|
-
expect(TOOLTIP_DEFAULT_SETTINGS.FONT_COLOR).toBe('#545a6b');
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
describe('LABEL_DEFAULT_OPTIONS', () => {
|
|
253
|
-
it('should have correct structure', () => {
|
|
254
|
-
expect(LABEL_DEFAULT_OPTIONS).toHaveProperty('style');
|
|
255
|
-
expect(LABEL_DEFAULT_OPTIONS).toHaveProperty('color');
|
|
256
|
-
expect(LABEL_DEFAULT_OPTIONS.style).toHaveProperty('fontSize');
|
|
257
|
-
expect(LABEL_DEFAULT_OPTIONS.style).toHaveProperty('fontFamily');
|
|
258
|
-
expect(LABEL_DEFAULT_OPTIONS.style).toHaveProperty('fontWeight');
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
describe('TOOLTIP_DEFAULT_OPTIONS', () => {
|
|
263
|
-
it('should have correct structure', () => {
|
|
264
|
-
expect(TOOLTIP_DEFAULT_OPTIONS).toHaveProperty('borderColor');
|
|
265
|
-
expect(TOOLTIP_DEFAULT_OPTIONS).toHaveProperty('shadow');
|
|
266
|
-
expect(TOOLTIP_DEFAULT_OPTIONS).toHaveProperty('style');
|
|
267
|
-
expect(TOOLTIP_DEFAULT_OPTIONS).toHaveProperty('enabled');
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it('should be enabled by default', () => {
|
|
271
|
-
expect(TOOLTIP_DEFAULT_OPTIONS.enabled).toBe(true);
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
describe('Reusable Disabled Conditions', () => {
|
|
276
|
-
describe('LABEL_DISABLED_CONDITION', () => {
|
|
277
|
-
it('should have disabled_str and disabled_fn', () => {
|
|
278
|
-
expect(LABEL_DISABLED_CONDITION).toHaveProperty('disabled_str');
|
|
279
|
-
expect(LABEL_DISABLED_CONDITION).toHaveProperty('disabled_fn');
|
|
280
|
-
expect(typeof LABEL_DISABLED_CONDITION.disabled_str).toBe('string');
|
|
281
|
-
expect(typeof LABEL_DISABLED_CONDITION.disabled_fn).toBe('function');
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
it('disabled_fn should return true when no options are enabled', () => {
|
|
285
|
-
const result = LABEL_DISABLED_CONDITION.disabled_fn({
|
|
286
|
-
show_out_of_x_axis: false,
|
|
287
|
-
show_out_of_data_series: false,
|
|
288
|
-
show_value: false,
|
|
289
|
-
});
|
|
290
|
-
expect(result).toBe(true);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it('disabled_fn should return false when at least one option is enabled', () => {
|
|
294
|
-
expect(LABEL_DISABLED_CONDITION.disabled_fn({ show_value: true })).toBe(false);
|
|
295
|
-
expect(LABEL_DISABLED_CONDITION.disabled_fn({ show_out_of_x_axis: true })).toBe(false);
|
|
296
|
-
expect(LABEL_DISABLED_CONDITION.disabled_fn({ show_out_of_data_series: true })).toBe(false);
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
describe('LABEL_PIE_DISABLED_CONDITION', () => {
|
|
301
|
-
it('should have disabled_str and disabled_fn', () => {
|
|
302
|
-
expect(LABEL_PIE_DISABLED_CONDITION).toHaveProperty('disabled_str');
|
|
303
|
-
expect(LABEL_PIE_DISABLED_CONDITION).toHaveProperty('disabled_fn');
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
it('disabled_fn should return true when no pie label options are enabled', () => {
|
|
307
|
-
const result = LABEL_PIE_DISABLED_CONDITION.disabled_fn({
|
|
308
|
-
show_percentage_in_labels: false,
|
|
309
|
-
show_value_in_labels: false,
|
|
310
|
-
});
|
|
311
|
-
expect(result).toBe(true);
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
it('disabled_fn should return false when at least one pie label option is enabled', () => {
|
|
315
|
-
expect(LABEL_PIE_DISABLED_CONDITION.disabled_fn({ show_value_in_labels: true })).toBe(false);
|
|
316
|
-
expect(LABEL_PIE_DISABLED_CONDITION.disabled_fn({ show_percentage_in_labels: true })).toBe(false);
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
describe('TOOLTIP_DISABLED_CONDITION', () => {
|
|
321
|
-
it('should have disabled_str and disabled_fn', () => {
|
|
322
|
-
expect(TOOLTIP_DISABLED_CONDITION).toHaveProperty('disabled_str');
|
|
323
|
-
expect(TOOLTIP_DISABLED_CONDITION).toHaveProperty('disabled_fn');
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
it('disabled_fn should return true when no tooltip options are enabled', () => {
|
|
327
|
-
const result = TOOLTIP_DISABLED_CONDITION.disabled_fn({
|
|
328
|
-
show_out_of_x_axis: false,
|
|
329
|
-
show_out_of_data_series: false,
|
|
330
|
-
show_value: false,
|
|
331
|
-
show_x_axis: false,
|
|
332
|
-
show_data_series: false,
|
|
333
|
-
});
|
|
334
|
-
expect(result).toBe(true);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it('disabled_fn should return false when at least one tooltip option is enabled', () => {
|
|
338
|
-
expect(TOOLTIP_DISABLED_CONDITION.disabled_fn({ show_x_axis: true })).toBe(false);
|
|
339
|
-
expect(TOOLTIP_DISABLED_CONDITION.disabled_fn({ show_data_series: true })).toBe(false);
|
|
340
|
-
expect(TOOLTIP_DISABLED_CONDITION.disabled_fn({ show_value: true })).toBe(false);
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
describe('TOOLTIP_PIE_DISABLED_CONDITION', () => {
|
|
345
|
-
it('should have disabled_str and disabled_fn', () => {
|
|
346
|
-
expect(TOOLTIP_PIE_DISABLED_CONDITION).toHaveProperty('disabled_str');
|
|
347
|
-
expect(TOOLTIP_PIE_DISABLED_CONDITION).toHaveProperty('disabled_fn');
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it('disabled_fn should return true when no pie tooltip options are enabled', () => {
|
|
351
|
-
const result = TOOLTIP_PIE_DISABLED_CONDITION.disabled_fn({
|
|
352
|
-
show_percentage: false,
|
|
353
|
-
show_value: false,
|
|
354
|
-
});
|
|
355
|
-
expect(result).toBe(true);
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
it('disabled_fn should return false when at least one pie tooltip option is enabled', () => {
|
|
359
|
-
expect(TOOLTIP_PIE_DISABLED_CONDITION.disabled_fn({ show_percentage: true })).toBe(false);
|
|
360
|
-
expect(TOOLTIP_PIE_DISABLED_CONDITION.disabled_fn({ show_value: true })).toBe(false);
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
describe('Reusable Elements', () => {
|
|
366
|
-
describe('LABEL_SHOW_TOGGLE', () => {
|
|
367
|
-
it('should be a toggle element with correct properties', () => {
|
|
368
|
-
expect(LABEL_SHOW_TOGGLE.element_type).toBe('toggle');
|
|
369
|
-
expect(LABEL_SHOW_TOGGLE.value_name).toBe('show');
|
|
370
|
-
expect(LABEL_SHOW_TOGGLE.element_label).toBe('Show');
|
|
371
|
-
expect(LABEL_SHOW_TOGGLE.default_value).toBe(true);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it('should use LABEL_DISABLED_CONDITION', () => {
|
|
375
|
-
expect(LABEL_SHOW_TOGGLE.disabled_str).toBe(LABEL_DISABLED_CONDITION.disabled_str);
|
|
376
|
-
expect(LABEL_SHOW_TOGGLE.disabled_fn).toBe(LABEL_DISABLED_CONDITION.disabled_fn);
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
describe('LABEL_PIE_SHOW_TOGGLE', () => {
|
|
381
|
-
it('should be a toggle element with correct properties', () => {
|
|
382
|
-
expect(LABEL_PIE_SHOW_TOGGLE.element_type).toBe('toggle');
|
|
383
|
-
expect(LABEL_PIE_SHOW_TOGGLE.value_name).toBe('show');
|
|
384
|
-
expect(LABEL_PIE_SHOW_TOGGLE.default_value).toBe(false);
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
it('should use LABEL_PIE_DISABLED_CONDITION', () => {
|
|
388
|
-
expect(LABEL_PIE_SHOW_TOGGLE.disabled_str).toBe(LABEL_PIE_DISABLED_CONDITION.disabled_str);
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
describe('LABEL_OVERLAP_TOGGLE', () => {
|
|
393
|
-
it('should be a toggle element with correct properties', () => {
|
|
394
|
-
expect(LABEL_OVERLAP_TOGGLE.element_type).toBe('toggle');
|
|
395
|
-
expect(LABEL_OVERLAP_TOGGLE.value_name).toBe('overlap');
|
|
396
|
-
expect(LABEL_OVERLAP_TOGGLE.element_label).toBe('Overlap');
|
|
397
|
-
expect(LABEL_OVERLAP_TOGGLE.default_value).toBe(false);
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
describe('TOOLTIP_SHOW_TOGGLE', () => {
|
|
402
|
-
it('should be a toggle element with correct properties', () => {
|
|
403
|
-
expect(TOOLTIP_SHOW_TOGGLE.element_type).toBe('toggle');
|
|
404
|
-
expect(TOOLTIP_SHOW_TOGGLE.value_name).toBe('show');
|
|
405
|
-
expect(TOOLTIP_SHOW_TOGGLE.default_value).toBe(true);
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
it('should use TOOLTIP_DISABLED_CONDITION', () => {
|
|
409
|
-
expect(TOOLTIP_SHOW_TOGGLE.disabled_str).toBe(TOOLTIP_DISABLED_CONDITION.disabled_str);
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
describe('TOOLTIP_PIE_SHOW_TOGGLE', () => {
|
|
414
|
-
it('should be a toggle element with correct properties', () => {
|
|
415
|
-
expect(TOOLTIP_PIE_SHOW_TOGGLE.element_type).toBe('toggle');
|
|
416
|
-
expect(TOOLTIP_PIE_SHOW_TOGGLE.value_name).toBe('show');
|
|
417
|
-
expect(TOOLTIP_PIE_SHOW_TOGGLE.default_value).toBe(true);
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
it('should use TOOLTIP_PIE_DISABLED_CONDITION', () => {
|
|
421
|
-
expect(TOOLTIP_PIE_SHOW_TOGGLE.disabled_str).toBe(TOOLTIP_PIE_DISABLED_CONDITION.disabled_str);
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
describe('GAUGE_SHOW_TOGGLE', () => {
|
|
426
|
-
it('should be a toggle element with correct properties', () => {
|
|
427
|
-
expect(GAUGE_SHOW_TOGGLE.element_type).toBe('toggle');
|
|
428
|
-
expect(GAUGE_SHOW_TOGGLE.value_name).toBe('show');
|
|
429
|
-
expect(GAUGE_SHOW_TOGGLE.default_value).toBe(true);
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
it('should NOT have disabled condition', () => {
|
|
433
|
-
expect(GAUGE_SHOW_TOGGLE.disabled_str).toBeUndefined();
|
|
434
|
-
expect(GAUGE_SHOW_TOGGLE.disabled_fn).toBeUndefined();
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
// =========================================================================
|
|
441
|
-
// Element Factory Tests
|
|
442
|
-
// =========================================================================
|
|
443
|
-
|
|
444
|
-
describe('Element Factories', () => {
|
|
445
|
-
describe('createToggle', () => {
|
|
446
|
-
it('should create a toggle element with required properties', () => {
|
|
447
|
-
const toggle = createToggle('show', 'Show', true);
|
|
448
|
-
|
|
449
|
-
expect(toggle).toEqual({
|
|
450
|
-
element_type: 'toggle',
|
|
451
|
-
element_label: 'Show',
|
|
452
|
-
value_name: 'show',
|
|
453
|
-
default_value: true,
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
it('should use false as default value when not provided', () => {
|
|
458
|
-
const toggle = createToggle('enabled', 'Enabled');
|
|
459
|
-
expect(toggle.default_value).toBe(false);
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
it('should merge additional options', () => {
|
|
463
|
-
const showFn = jest.fn();
|
|
464
|
-
const toggle = createToggle('show', 'Show', true, { showFn });
|
|
465
|
-
|
|
466
|
-
expect(toggle.showFn).toBe(showFn);
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
it('should support disabled_str and disabled_fn options', () => {
|
|
470
|
-
const disabled_fn = jest.fn();
|
|
471
|
-
const toggle = createToggle('show', 'Show', true, {
|
|
472
|
-
disabled_str: '!{var}.other',
|
|
473
|
-
disabled_fn,
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
expect(toggle.disabled_str).toBe('!{var}.other');
|
|
477
|
-
expect(toggle.disabled_fn).toBe(disabled_fn);
|
|
478
|
-
});
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
describe('createCheckbox', () => {
|
|
482
|
-
it('should create a checkbox element with required properties', () => {
|
|
483
|
-
const checkbox = createCheckbox('enabled', 'Enabled', true);
|
|
484
|
-
|
|
485
|
-
expect(checkbox).toEqual({
|
|
486
|
-
element_type: 'checkbox',
|
|
487
|
-
element_label: 'Enabled',
|
|
488
|
-
value_name: 'enabled',
|
|
489
|
-
default_value: true,
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
it('should use false as default value when not provided', () => {
|
|
494
|
-
const checkbox = createCheckbox('active', 'Active');
|
|
495
|
-
expect(checkbox.default_value).toBe(false);
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
it('should support clickFn option', () => {
|
|
499
|
-
const clickFn = jest.fn();
|
|
500
|
-
const checkbox = createCheckbox('value', 'Value', true, { clickFn });
|
|
501
|
-
|
|
502
|
-
expect(checkbox.clickFn).toBe(clickFn);
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
it('should support hidden option', () => {
|
|
506
|
-
const checkbox = createCheckbox('hidden', 'Hidden', false, { hidden: true });
|
|
507
|
-
expect(checkbox.hidden).toBe(true);
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
describe('createInput', () => {
|
|
512
|
-
it('should create an input element with required properties', () => {
|
|
513
|
-
const input = createInput('name', 'Name', 'default');
|
|
514
|
-
|
|
515
|
-
expect(input).toEqual({
|
|
516
|
-
element_type: 'input',
|
|
517
|
-
element_label: 'Name',
|
|
518
|
-
value_name: 'name',
|
|
519
|
-
default_value: 'default',
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
it('should use empty string as default value when not provided', () => {
|
|
524
|
-
const input = createInput('title', 'Title');
|
|
525
|
-
expect(input.default_value).toBe('');
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
it('should support numeric default values', () => {
|
|
529
|
-
const input = createInput('count', 'Count', 10);
|
|
530
|
-
expect(input.default_value).toBe(10);
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
it('should support null default values', () => {
|
|
534
|
-
const input = createInput('optional', 'Optional', null);
|
|
535
|
-
expect(input.default_value).toBeNull();
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
it('should support label_tooltip option', () => {
|
|
539
|
-
const input = createInput('value', 'Value', '', { label_tooltip: 'Help text' });
|
|
540
|
-
expect(input.label_tooltip).toBe('Help text');
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
it('should support show_in_one_row option', () => {
|
|
544
|
-
const input = createInput('value', 'Value', '', { show_in_one_row: true });
|
|
545
|
-
expect(input.show_in_one_row).toBe(true);
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
describe('createSelect', () => {
|
|
550
|
-
const fontOptions = [
|
|
551
|
-
{ label: 'Arial', value: 'Arial' },
|
|
552
|
-
{ label: 'Poppins', value: 'Poppins' },
|
|
553
|
-
];
|
|
554
|
-
|
|
555
|
-
it('should create a select element with required properties', () => {
|
|
556
|
-
const select = createSelect('font', 'Font', fontOptions, 'Arial');
|
|
557
|
-
|
|
558
|
-
expect(select.element_type).toBe('select');
|
|
559
|
-
expect(select.element_label).toBe('Font');
|
|
560
|
-
expect(select.value_name).toBe('font');
|
|
561
|
-
expect(select.element_options).toEqual(fontOptions);
|
|
562
|
-
expect(select.default_value).toBe('Arial');
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
it('should support string array as options', () => {
|
|
566
|
-
const stringOptions = ['Arial', 'Poppins', 'Helvetica'];
|
|
567
|
-
const select = createSelect('font', 'Font', stringOptions, 'Arial');
|
|
568
|
-
|
|
569
|
-
expect(select.element_options).toEqual(stringOptions);
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
it('should work without default value', () => {
|
|
573
|
-
const select = createSelect('font', 'Font', fontOptions);
|
|
574
|
-
expect(select.default_value).toBeUndefined();
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
describe('createRadio', () => {
|
|
579
|
-
const alignOptions = [
|
|
580
|
-
{ label: 'Left', value: 'left' },
|
|
581
|
-
{ label: 'Center', value: 'center' },
|
|
582
|
-
{ label: 'Right', value: 'right' },
|
|
583
|
-
];
|
|
584
|
-
|
|
585
|
-
it('should create a radio element with required properties', () => {
|
|
586
|
-
const radio = createRadio('align', 'Alignment', alignOptions, 'left');
|
|
587
|
-
|
|
588
|
-
expect(radio.element_type).toBe('radio');
|
|
589
|
-
expect(radio.element_label).toBe('Alignment');
|
|
590
|
-
expect(radio.value_name).toBe('align');
|
|
591
|
-
expect(radio.element_options).toEqual(alignOptions);
|
|
592
|
-
expect(radio.default_value).toBe('left');
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
it('should use empty string as default value when not provided', () => {
|
|
596
|
-
const radio = createRadio('align', 'Alignment', alignOptions);
|
|
597
|
-
expect(radio.default_value).toBe('');
|
|
598
|
-
});
|
|
599
|
-
|
|
600
|
-
it('should support element_sub_title option', () => {
|
|
601
|
-
const radio = createRadio('align', 'Alignment', alignOptions, 'left', {
|
|
602
|
-
element_sub_title: 'Choose alignment',
|
|
603
|
-
});
|
|
604
|
-
expect(radio.element_sub_title).toBe('Choose alignment');
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
describe('createColorPicker', () => {
|
|
609
|
-
it('should create a color picker element with required properties', () => {
|
|
610
|
-
const colorPicker = createColorPicker('color', 'Color', '#ff0000');
|
|
611
|
-
|
|
612
|
-
expect(colorPicker).toEqual({
|
|
613
|
-
element_type: 'color_picker',
|
|
614
|
-
element_label: 'Color',
|
|
615
|
-
value_name: 'color',
|
|
616
|
-
default_value: '#ff0000',
|
|
617
|
-
});
|
|
618
|
-
});
|
|
619
|
-
|
|
620
|
-
it('should use empty string as default value when not provided', () => {
|
|
621
|
-
const colorPicker = createColorPicker('color', 'Color');
|
|
622
|
-
expect(colorPicker.default_value).toBe('');
|
|
623
|
-
});
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
describe('createDivider', () => {
|
|
627
|
-
it('should create a divider element without label', () => {
|
|
628
|
-
const divider = createDivider();
|
|
629
|
-
|
|
630
|
-
expect(divider.element_type).toBe('devider');
|
|
631
|
-
expect(divider.element_label).toBeUndefined();
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
it('should create a divider element with label', () => {
|
|
635
|
-
const divider = createDivider('Section Title');
|
|
636
|
-
|
|
637
|
-
expect(divider.element_type).toBe('devider');
|
|
638
|
-
expect(divider.element_label).toBe('Section Title');
|
|
639
|
-
});
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
describe('createTextarea', () => {
|
|
643
|
-
it('should create a textarea element with required properties', () => {
|
|
644
|
-
const textarea = createTextarea('description', 'Description', 'default text');
|
|
645
|
-
|
|
646
|
-
expect(textarea).toEqual({
|
|
647
|
-
element_type: 'textarea',
|
|
648
|
-
element_label: 'Description',
|
|
649
|
-
value_name: 'description',
|
|
650
|
-
default_value: 'default text',
|
|
651
|
-
});
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
it('should use empty string as default value when not provided', () => {
|
|
655
|
-
const textarea = createTextarea('notes', 'Notes');
|
|
656
|
-
expect(textarea.default_value).toBe('');
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
describe('createTag', () => {
|
|
661
|
-
it('should create a tag element with required properties', () => {
|
|
662
|
-
const tag = createTag('tags', 'Tags', ['tag1', 'tag2']);
|
|
663
|
-
|
|
664
|
-
expect(tag.element_type).toBe('tag');
|
|
665
|
-
expect(tag.element_label).toBe('Tags');
|
|
666
|
-
expect(tag.value_name).toBe('tags');
|
|
667
|
-
expect(tag.default_value).toEqual(['tag1', 'tag2']);
|
|
668
|
-
});
|
|
669
|
-
|
|
670
|
-
it('should use empty array as default value when not provided', () => {
|
|
671
|
-
const tag = createTag('tags', 'Tags');
|
|
672
|
-
expect(tag.default_value).toEqual([]);
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
it('should set tag options with defaults', () => {
|
|
676
|
-
const tag = createTag('tags', 'Tags');
|
|
677
|
-
|
|
678
|
-
expect(tag.element_options).toEqual({
|
|
679
|
-
add_new_tag: true,
|
|
680
|
-
searchable: true,
|
|
681
|
-
multiple: true,
|
|
682
|
-
});
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
it('should allow overriding tag options', () => {
|
|
686
|
-
const tag = createTag('tags', 'Tags', [], {
|
|
687
|
-
add_new_tag: false,
|
|
688
|
-
searchable: false,
|
|
689
|
-
multiple: false,
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
expect(tag.element_options).toEqual({
|
|
693
|
-
add_new_tag: false,
|
|
694
|
-
searchable: false,
|
|
695
|
-
multiple: false,
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
describe('createFontStylingGroup', () => {
|
|
701
|
-
it('should return array of 3 elements', () => {
|
|
702
|
-
const group = createFontStylingGroup();
|
|
703
|
-
expect(group).toHaveLength(3);
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
it('should contain font_style select, font_size select, and font_color picker', () => {
|
|
707
|
-
const group = createFontStylingGroup();
|
|
708
|
-
|
|
709
|
-
expect(group[0].value_name).toBe('font_style');
|
|
710
|
-
expect(group[0].element_type).toBe('select');
|
|
711
|
-
|
|
712
|
-
expect(group[1].value_name).toBe('font_size');
|
|
713
|
-
expect(group[1].element_type).toBe('select');
|
|
714
|
-
|
|
715
|
-
expect(group[2].value_name).toBe('font_color');
|
|
716
|
-
expect(group[2].element_type).toBe('color_picker');
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
it('should use label defaults when no custom defaults provided', () => {
|
|
720
|
-
const group = createFontStylingGroup();
|
|
721
|
-
|
|
722
|
-
expect(group[0].default_value).toBe(LABEL_DEFAULT_SETTINGS.FONT_FAMILY);
|
|
723
|
-
expect(group[1].default_value).toBe(LABEL_DEFAULT_SETTINGS.FONT_SIZE);
|
|
724
|
-
expect(group[2].default_value).toBe(LABEL_DEFAULT_SETTINGS.FONT_COLOR);
|
|
725
|
-
});
|
|
726
|
-
|
|
727
|
-
it('should allow custom defaults', () => {
|
|
728
|
-
const group = createFontStylingGroup({
|
|
729
|
-
fontStyle: 'Arial',
|
|
730
|
-
fontSize: '14',
|
|
731
|
-
fontColor: '#000000',
|
|
732
|
-
});
|
|
733
|
-
|
|
734
|
-
expect(group[0].default_value).toBe('Arial');
|
|
735
|
-
expect(group[1].default_value).toBe('14');
|
|
736
|
-
expect(group[2].default_value).toBe('#000000');
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
describe('createLabelStyleGroup', () => {
|
|
741
|
-
it('should return array with dividers and font styling', () => {
|
|
742
|
-
const group = createLabelStyleGroup();
|
|
743
|
-
|
|
744
|
-
// Should have 2 dividers + 3 font styling elements
|
|
745
|
-
expect(group).toHaveLength(5);
|
|
746
|
-
expect(group[0].element_type).toBe('devider');
|
|
747
|
-
expect(group[1].element_type).toBe('devider');
|
|
748
|
-
expect(group[1].element_label).toBe('Label Style');
|
|
749
|
-
});
|
|
750
|
-
});
|
|
751
|
-
|
|
752
|
-
describe('createTooltipStyleGroup', () => {
|
|
753
|
-
it('should return array with dividers and font styling', () => {
|
|
754
|
-
const group = createTooltipStyleGroup();
|
|
755
|
-
|
|
756
|
-
// Should have 2 dividers + 3 font styling elements
|
|
757
|
-
expect(group).toHaveLength(5);
|
|
758
|
-
expect(group[0].element_type).toBe('devider');
|
|
759
|
-
expect(group[1].element_type).toBe('devider');
|
|
760
|
-
expect(group[1].element_label).toBe('Tooltip Style');
|
|
761
|
-
});
|
|
762
|
-
|
|
763
|
-
it('should use tooltip defaults', () => {
|
|
764
|
-
const group = createTooltipStyleGroup();
|
|
765
|
-
|
|
766
|
-
expect(group[2].default_value).toBe(TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY);
|
|
767
|
-
expect(group[3].default_value).toBe(TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE);
|
|
768
|
-
expect(group[4].default_value).toBe(TOOLTIP_DEFAULT_SETTINGS.FONT_COLOR);
|
|
769
|
-
});
|
|
770
|
-
});
|
|
771
|
-
});
|
|
772
|
-
|
|
773
|
-
// =========================================================================
|
|
774
|
-
// Builder Tests
|
|
775
|
-
// =========================================================================
|
|
776
|
-
|
|
777
|
-
describe('Builders', () => {
|
|
778
|
-
// Helper to validate SuboptionDefinition structure
|
|
779
|
-
const expectValidSuboptionDefinition = (def) => {
|
|
780
|
-
expect(def).toHaveProperty('category_class');
|
|
781
|
-
expect(def).toHaveProperty('category_label');
|
|
782
|
-
expect(def).toHaveProperty('category_type');
|
|
783
|
-
expect(typeof def.category_class).toBe('string');
|
|
784
|
-
expect(typeof def.category_label).toBe('string');
|
|
785
|
-
expect(typeof def.category_type).toBe('string');
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
describe('Label builders', () => {
|
|
789
|
-
describe('withLabel', () => {
|
|
790
|
-
it('should return valid SuboptionDefinition', () => {
|
|
791
|
-
const result = withLabel();
|
|
792
|
-
expectValidSuboptionDefinition(result);
|
|
793
|
-
});
|
|
794
|
-
|
|
795
|
-
it('should have correct category properties', () => {
|
|
796
|
-
const result = withLabel();
|
|
797
|
-
expect(result.category_type).toBe('label');
|
|
798
|
-
expect(result.category_label).toBe('Label');
|
|
799
|
-
expect(result.category_class).toBe(DEFAULT_CATEGORY_CLASS);
|
|
800
|
-
});
|
|
801
|
-
|
|
802
|
-
it('should have elements array', () => {
|
|
803
|
-
const result = withLabel();
|
|
804
|
-
expect(Array.isArray(result.elements)).toBe(true);
|
|
805
|
-
expect(result.elements.length).toBeGreaterThan(0);
|
|
806
|
-
});
|
|
807
|
-
|
|
808
|
-
it('should use shared LABEL_SHOW_TOGGLE element', () => {
|
|
809
|
-
const result = withLabel();
|
|
810
|
-
const showElement = result.elements.find(e => e.value_name === 'show');
|
|
811
|
-
// Verify it uses the exact shared element reference
|
|
812
|
-
expect(showElement).toBe(LABEL_SHOW_TOGGLE);
|
|
813
|
-
});
|
|
814
|
-
|
|
815
|
-
it('should use shared LABEL_OVERLAP_TOGGLE element', () => {
|
|
816
|
-
const result = withLabel();
|
|
817
|
-
const overlapElement = result.elements.find(e => e.value_name === 'overlap');
|
|
818
|
-
expect(overlapElement).toBe(LABEL_OVERLAP_TOGGLE);
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
it('should include font styling elements', () => {
|
|
822
|
-
const result = withLabel();
|
|
823
|
-
const fontStyle = result.elements.find(e => e.value_name === 'font_style');
|
|
824
|
-
const fontSize = result.elements.find(e => e.value_name === 'font_size');
|
|
825
|
-
const fontColor = result.elements.find(e => e.value_name === 'font_color');
|
|
826
|
-
|
|
827
|
-
expect(fontStyle).toBeDefined();
|
|
828
|
-
expect(fontSize).toBeDefined();
|
|
829
|
-
expect(fontColor).toBeDefined();
|
|
830
|
-
});
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
describe('withLabelPie', () => {
|
|
834
|
-
it('should return valid SuboptionDefinition', () => {
|
|
835
|
-
const result = withLabelPie();
|
|
836
|
-
expectValidSuboptionDefinition(result);
|
|
837
|
-
});
|
|
838
|
-
|
|
839
|
-
it('should have correct category type', () => {
|
|
840
|
-
const result = withLabelPie();
|
|
841
|
-
expect(result.category_type).toBe('label_pie');
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
it('should include pie-specific options', () => {
|
|
845
|
-
const result = withLabelPie();
|
|
846
|
-
const useAreaColor = result.elements.find(e => e.value_name === 'use_area_color');
|
|
847
|
-
const showPercentage = result.elements.find(e => e.value_name === 'show_percentage_in_labels');
|
|
848
|
-
|
|
849
|
-
expect(useAreaColor).toBeDefined();
|
|
850
|
-
expect(showPercentage).toBeDefined();
|
|
851
|
-
});
|
|
852
|
-
});
|
|
853
|
-
|
|
854
|
-
describe('withLabelGauge', () => {
|
|
855
|
-
it('should return valid SuboptionDefinition', () => {
|
|
856
|
-
const result = withLabelGauge();
|
|
857
|
-
expectValidSuboptionDefinition(result);
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
it('should have correct category type', () => {
|
|
861
|
-
const result = withLabelGauge();
|
|
862
|
-
expect(result.category_type).toBe('label');
|
|
863
|
-
});
|
|
864
|
-
|
|
865
|
-
it('should include gauge-specific options', () => {
|
|
866
|
-
const result = withLabelGauge();
|
|
867
|
-
const showPercentageInValue = result.elements.find(e => e.value_name === 'show_percentage_in_value');
|
|
868
|
-
const showGoalName = result.elements.find(e => e.value_name === 'show_goal_name');
|
|
869
|
-
|
|
870
|
-
expect(showPercentageInValue).toBeDefined();
|
|
871
|
-
expect(showGoalName).toBeDefined();
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
it('should use enableGaugeDynamicGoal config for goal_name visibility', () => {
|
|
875
|
-
const result = withLabelGauge({ enableGaugeDynamicGoal: true });
|
|
876
|
-
|
|
877
|
-
const goalName = result.elements.find(e => e.value_name === 'goal_name');
|
|
878
|
-
expect(goalName).toBeDefined();
|
|
879
|
-
expect(goalName.showFn).toBeDefined();
|
|
880
|
-
|
|
881
|
-
expect(goalName.showFn()).toBe(true);
|
|
882
|
-
});
|
|
883
|
-
});
|
|
884
|
-
|
|
885
|
-
describe('withLabelWithPercentage', () => {
|
|
886
|
-
it('should return valid SuboptionDefinition', () => {
|
|
887
|
-
const result = withLabelWithPercentage();
|
|
888
|
-
expectValidSuboptionDefinition(result);
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
it('should include percentage options', () => {
|
|
892
|
-
const result = withLabelWithPercentage();
|
|
893
|
-
const presentTotal = result.elements.find(e => e.value_name === 'present_total');
|
|
894
|
-
const showPercentage = result.elements.find(e => e.value_name === 'show_percentage');
|
|
895
|
-
|
|
896
|
-
expect(presentTotal).toBeDefined();
|
|
897
|
-
expect(showPercentage).toBeDefined();
|
|
898
|
-
});
|
|
899
|
-
});
|
|
900
|
-
|
|
901
|
-
describe('withLabelWithPercentagePercentStacked', () => {
|
|
902
|
-
it('should return valid SuboptionDefinition', () => {
|
|
903
|
-
const result = withLabelWithPercentagePercentStacked();
|
|
904
|
-
expectValidSuboptionDefinition(result);
|
|
905
|
-
});
|
|
906
|
-
});
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
describe('Tooltip builders', () => {
|
|
910
|
-
describe('withTooltip', () => {
|
|
911
|
-
it('should return valid SuboptionDefinition', () => {
|
|
912
|
-
const result = withTooltip();
|
|
913
|
-
expectValidSuboptionDefinition(result);
|
|
914
|
-
});
|
|
915
|
-
|
|
916
|
-
it('should have correct category properties', () => {
|
|
917
|
-
const result = withTooltip();
|
|
918
|
-
expect(result.category_type).toBe('tooltips');
|
|
919
|
-
expect(result.category_label).toBe('Tooltip');
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
it('should include tooltip-specific elements', () => {
|
|
923
|
-
const result = withTooltip();
|
|
924
|
-
const show = result.elements.find(e => e.value_name === 'show');
|
|
925
|
-
const showValue = result.elements.find(e => e.value_name === 'show_value');
|
|
926
|
-
|
|
927
|
-
expect(show).toBeDefined();
|
|
928
|
-
expect(showValue).toBeDefined();
|
|
929
|
-
});
|
|
930
|
-
});
|
|
931
|
-
|
|
932
|
-
describe('withTooltipPie', () => {
|
|
933
|
-
it('should return valid SuboptionDefinition', () => {
|
|
934
|
-
const result = withTooltipPie();
|
|
935
|
-
expectValidSuboptionDefinition(result);
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
it('should have correct category type', () => {
|
|
939
|
-
const result = withTooltipPie();
|
|
940
|
-
// Note: tooltips_pie uses 'tooltips' as category_type but is keyed as 'tooltips_pie'
|
|
941
|
-
expect(result.category_type).toBe('tooltips');
|
|
942
|
-
});
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
describe('withTooltipGauge', () => {
|
|
946
|
-
it('should return valid SuboptionDefinition', () => {
|
|
947
|
-
const result = withTooltipGauge();
|
|
948
|
-
expectValidSuboptionDefinition(result);
|
|
949
|
-
});
|
|
950
|
-
|
|
951
|
-
it('should have correct category type', () => {
|
|
952
|
-
const result = withTooltipGauge();
|
|
953
|
-
expect(result.category_type).toBe('tooltips');
|
|
954
|
-
});
|
|
955
|
-
});
|
|
956
|
-
});
|
|
957
|
-
|
|
958
|
-
describe('Axis builders', () => {
|
|
959
|
-
describe('withAxisY', () => {
|
|
960
|
-
it('should return valid SuboptionDefinition', () => {
|
|
961
|
-
const result = withAxisY();
|
|
962
|
-
expectValidSuboptionDefinition(result);
|
|
963
|
-
});
|
|
964
|
-
|
|
965
|
-
it('should have correct category properties', () => {
|
|
966
|
-
const result = withAxisY();
|
|
967
|
-
expect(result.category_type).toBe('axisY');
|
|
968
|
-
expect(result.category_label).toBe('Y Axis');
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
it('should include min/max inputs', () => {
|
|
972
|
-
const result = withAxisY();
|
|
973
|
-
const min = result.elements.find(e => e.value_name === 'min');
|
|
974
|
-
const max = result.elements.find(e => e.value_name === 'max');
|
|
975
|
-
|
|
976
|
-
expect(min).toBeDefined();
|
|
977
|
-
expect(max).toBeDefined();
|
|
978
|
-
});
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
describe('withAxisYPercentStacked', () => {
|
|
982
|
-
it('should return valid SuboptionDefinition', () => {
|
|
983
|
-
const result = withAxisYPercentStacked();
|
|
984
|
-
expectValidSuboptionDefinition(result);
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
it('should NOT include min/max inputs', () => {
|
|
988
|
-
const result = withAxisYPercentStacked();
|
|
989
|
-
const min = result.elements.find(e => e.value_name === 'min');
|
|
990
|
-
const max = result.elements.find(e => e.value_name === 'max');
|
|
991
|
-
|
|
992
|
-
expect(min).toBeUndefined();
|
|
993
|
-
expect(max).toBeUndefined();
|
|
994
|
-
});
|
|
995
|
-
});
|
|
996
|
-
|
|
997
|
-
describe('withAxisX', () => {
|
|
998
|
-
it('should return valid SuboptionDefinition', () => {
|
|
999
|
-
const result = withAxisX();
|
|
1000
|
-
expectValidSuboptionDefinition(result);
|
|
1001
|
-
});
|
|
1002
|
-
|
|
1003
|
-
it('should have correct category properties', () => {
|
|
1004
|
-
const result = withAxisX();
|
|
1005
|
-
expect(result.category_type).toBe('axisX');
|
|
1006
|
-
expect(result.category_label).toBe('X Axis');
|
|
1007
|
-
});
|
|
1008
|
-
});
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
|
-
describe('Table builders', () => {
|
|
1012
|
-
describe('withTableOptions', () => {
|
|
1013
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1014
|
-
const result = withTableOptions();
|
|
1015
|
-
expectValidSuboptionDefinition(result);
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
it('should have correct category properties', () => {
|
|
1019
|
-
const result = withTableOptions();
|
|
1020
|
-
expect(result.category_type).toBe('table_options');
|
|
1021
|
-
expect(result.category_label).toBe('Table');
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1024
|
-
it('should include table-specific options', () => {
|
|
1025
|
-
const result = withTableOptions();
|
|
1026
|
-
const showColumnTotal = result.elements.find(e => e.value_name === 'show_column_total');
|
|
1027
|
-
const showRowTotal = result.elements.find(e => e.value_name === 'show_row_total');
|
|
1028
|
-
|
|
1029
|
-
expect(showColumnTotal).toBeDefined();
|
|
1030
|
-
expect(showRowTotal).toBeDefined();
|
|
1031
|
-
});
|
|
1032
|
-
});
|
|
1033
|
-
|
|
1034
|
-
describe('withTableOptionsTranspose', () => {
|
|
1035
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1036
|
-
const result = withTableOptionsTranspose();
|
|
1037
|
-
expectValidSuboptionDefinition(result);
|
|
1038
|
-
});
|
|
1039
|
-
|
|
1040
|
-
it('should have transpose disabled by default', () => {
|
|
1041
|
-
const result = withTableOptionsTranspose();
|
|
1042
|
-
const transpose = result.elements.find(e => e.value_name === 'transpose_table');
|
|
1043
|
-
|
|
1044
|
-
expect(transpose).toBeDefined();
|
|
1045
|
-
expect(transpose.default_value).toBe(false);
|
|
1046
|
-
});
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
describe('withTableOptionsGauge', () => {
|
|
1050
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1051
|
-
const result = withTableOptionsGauge();
|
|
1052
|
-
expectValidSuboptionDefinition(result);
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
it('should have simplified options', () => {
|
|
1056
|
-
const result = withTableOptionsGauge();
|
|
1057
|
-
// Gauge table options should have fewer elements
|
|
1058
|
-
expect(result.elements.length).toBeLessThan(5);
|
|
1059
|
-
});
|
|
1060
|
-
});
|
|
1061
|
-
|
|
1062
|
-
describe('withTableDesignOptions', () => {
|
|
1063
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1064
|
-
const result = withTableDesignOptions();
|
|
1065
|
-
expectValidSuboptionDefinition(result);
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
|
-
it('should have correct category properties', () => {
|
|
1069
|
-
const result = withTableDesignOptions();
|
|
1070
|
-
expect(result.category_type).toBe('table_design_options');
|
|
1071
|
-
expect(result.category_label).toBe('Table design');
|
|
1072
|
-
});
|
|
1073
|
-
});
|
|
1074
|
-
});
|
|
1075
|
-
|
|
1076
|
-
describe('Chart config builders', () => {
|
|
1077
|
-
describe('withChart', () => {
|
|
1078
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1079
|
-
const result = withChart();
|
|
1080
|
-
expectValidSuboptionDefinition(result);
|
|
1081
|
-
});
|
|
1082
|
-
|
|
1083
|
-
it('should have correct category properties', () => {
|
|
1084
|
-
const result = withChart();
|
|
1085
|
-
expect(result.category_type).toBe('chart');
|
|
1086
|
-
});
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
describe('withChartGrid', () => {
|
|
1090
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1091
|
-
const result = withChartGrid();
|
|
1092
|
-
expectValidSuboptionDefinition(result);
|
|
1093
|
-
});
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
describe('withChartForecast', () => {
|
|
1097
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1098
|
-
const result = withChartForecast();
|
|
1099
|
-
expectValidSuboptionDefinition(result);
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
describe('withChartPosition', () => {
|
|
1104
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1105
|
-
const result = withChartPosition();
|
|
1106
|
-
expectValidSuboptionDefinition(result);
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
});
|
|
1110
|
-
|
|
1111
|
-
describe('Other builders', () => {
|
|
1112
|
-
describe('withWidgetLibrary', () => {
|
|
1113
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1114
|
-
const result = withWidgetLibrary();
|
|
1115
|
-
expectValidSuboptionDefinition(result);
|
|
1116
|
-
});
|
|
1117
|
-
|
|
1118
|
-
it('should be hidden', () => {
|
|
1119
|
-
const result = withWidgetLibrary();
|
|
1120
|
-
expect(result.is_hidden).toBe(true);
|
|
1121
|
-
});
|
|
1122
|
-
});
|
|
1123
|
-
|
|
1124
|
-
describe('withSubtitle', () => {
|
|
1125
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1126
|
-
const result = withSubtitle();
|
|
1127
|
-
expectValidSuboptionDefinition(result);
|
|
1128
|
-
});
|
|
1129
|
-
});
|
|
1130
|
-
|
|
1131
|
-
describe('withName', () => {
|
|
1132
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1133
|
-
const result = withName();
|
|
1134
|
-
expectValidSuboptionDefinition(result);
|
|
1135
|
-
});
|
|
1136
|
-
});
|
|
1137
|
-
|
|
1138
|
-
describe('withNegativeNumberFormat', () => {
|
|
1139
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1140
|
-
const result = withNegativeNumberFormat();
|
|
1141
|
-
expectValidSuboptionDefinition(result);
|
|
1142
|
-
});
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
describe('withValue', () => {
|
|
1146
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1147
|
-
const result = withValue();
|
|
1148
|
-
expectValidSuboptionDefinition(result);
|
|
1149
|
-
});
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
describe('withRange', () => {
|
|
1153
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1154
|
-
const result = withRange();
|
|
1155
|
-
expectValidSuboptionDefinition(result);
|
|
1156
|
-
});
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
describe('withTicks', () => {
|
|
1160
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1161
|
-
const result = withTicks();
|
|
1162
|
-
expectValidSuboptionDefinition(result);
|
|
1163
|
-
});
|
|
1164
|
-
});
|
|
1165
|
-
|
|
1166
|
-
describe('withLegends', () => {
|
|
1167
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1168
|
-
const result = withLegends();
|
|
1169
|
-
expectValidSuboptionDefinition(result);
|
|
1170
|
-
});
|
|
1171
|
-
});
|
|
1172
|
-
|
|
1173
|
-
describe('withDeltaColumn', () => {
|
|
1174
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1175
|
-
const result = withDeltaColumn();
|
|
1176
|
-
expectValidSuboptionDefinition(result);
|
|
1177
|
-
});
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
|
-
describe('withDeltaColumnForDrillDown', () => {
|
|
1181
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1182
|
-
const result = withDeltaColumnForDrillDown();
|
|
1183
|
-
expectValidSuboptionDefinition(result);
|
|
1184
|
-
});
|
|
1185
|
-
});
|
|
1186
|
-
|
|
1187
|
-
describe('withAdvanced', () => {
|
|
1188
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1189
|
-
const result = withAdvanced();
|
|
1190
|
-
expectValidSuboptionDefinition(result);
|
|
1191
|
-
});
|
|
1192
|
-
});
|
|
1193
|
-
|
|
1194
|
-
describe('withTotalValueLabelDonut', () => {
|
|
1195
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1196
|
-
const result = withTotalValueLabelDonut();
|
|
1197
|
-
expectValidSuboptionDefinition(result);
|
|
1198
|
-
});
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
|
-
describe('withGaugeGoal', () => {
|
|
1202
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1203
|
-
const result = withGaugeGoal();
|
|
1204
|
-
expectValidSuboptionDefinition(result);
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
it('should be hidden', () => {
|
|
1208
|
-
const result = withGaugeGoal();
|
|
1209
|
-
expect(result.is_hidden).toBe(true);
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
|
-
describe('withGaugeSegments', () => {
|
|
1214
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1215
|
-
const result = withGaugeSegments();
|
|
1216
|
-
expectValidSuboptionDefinition(result);
|
|
1217
|
-
});
|
|
1218
|
-
|
|
1219
|
-
it('should be hidden', () => {
|
|
1220
|
-
const result = withGaugeSegments();
|
|
1221
|
-
expect(result.is_hidden).toBe(true);
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1224
|
-
it('should use provided default segments', () => {
|
|
1225
|
-
const customSegments = [
|
|
1226
|
-
{ from: 0, to: 100, color: 'green', title: 'Good' },
|
|
1227
|
-
];
|
|
1228
|
-
const result = withGaugeSegments({ defaultSegments: customSegments });
|
|
1229
|
-
|
|
1230
|
-
expect(result.default_value).toEqual(customSegments);
|
|
1231
|
-
});
|
|
1232
|
-
|
|
1233
|
-
it('should use fallback segments when not provided', () => {
|
|
1234
|
-
const result = withGaugeSegments();
|
|
1235
|
-
|
|
1236
|
-
expect(result.default_value).toBeDefined();
|
|
1237
|
-
expect(Array.isArray(result.default_value)).toBe(true);
|
|
1238
|
-
expect(result.default_value.length).toBeGreaterThan(0);
|
|
1239
|
-
});
|
|
1240
|
-
});
|
|
1241
|
-
|
|
1242
|
-
describe('withGaugeIsAbsolute', () => {
|
|
1243
|
-
it('should return valid SuboptionDefinition', () => {
|
|
1244
|
-
const result = withGaugeIsAbsolute();
|
|
1245
|
-
expectValidSuboptionDefinition(result);
|
|
1246
|
-
});
|
|
1247
|
-
|
|
1248
|
-
it('should be hidden', () => {
|
|
1249
|
-
const result = withGaugeIsAbsolute();
|
|
1250
|
-
expect(result.is_hidden).toBe(true);
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
it('should have false as default value', () => {
|
|
1254
|
-
const result = withGaugeIsAbsolute();
|
|
1255
|
-
expect(result.default_value).toBe(false);
|
|
1256
|
-
});
|
|
1257
|
-
});
|
|
1258
|
-
});
|
|
1259
|
-
});
|
|
1260
|
-
|
|
1261
|
-
// =========================================================================
|
|
1262
|
-
// Preset Tests
|
|
1263
|
-
// =========================================================================
|
|
1264
|
-
|
|
1265
|
-
describe('Presets', () => {
|
|
1266
|
-
describe('CHART_PRESETS', () => {
|
|
1267
|
-
it('should be defined', () => {
|
|
1268
|
-
expect(CHART_PRESETS).toBeDefined();
|
|
1269
|
-
});
|
|
1270
|
-
|
|
1271
|
-
it('should have presets for all common chart types', () => {
|
|
1272
|
-
expect(CHART_PRESETS[CHART_TYPES.LINE_CHART]).toBeDefined();
|
|
1273
|
-
expect(CHART_PRESETS[CHART_TYPES.COLUMN_CHART]).toBeDefined();
|
|
1274
|
-
expect(CHART_PRESETS[CHART_TYPES.BAR_CHART]).toBeDefined();
|
|
1275
|
-
expect(CHART_PRESETS[CHART_TYPES.PIE_CHART]).toBeDefined();
|
|
1276
|
-
expect(CHART_PRESETS[CHART_TYPES.GAUGE_CHART_ENHANCED]).toBeDefined();
|
|
1277
|
-
});
|
|
1278
|
-
|
|
1279
|
-
it('should have arrays of builder functions', () => {
|
|
1280
|
-
const lineChartPreset = CHART_PRESETS[CHART_TYPES.LINE_CHART];
|
|
1281
|
-
|
|
1282
|
-
expect(Array.isArray(lineChartPreset)).toBe(true);
|
|
1283
|
-
lineChartPreset.forEach(builder => {
|
|
1284
|
-
expect(typeof builder).toBe('function');
|
|
1285
|
-
});
|
|
1286
|
-
});
|
|
1287
|
-
});
|
|
1288
|
-
|
|
1289
|
-
describe('BUILDER_KEY_MAP', () => {
|
|
1290
|
-
it('should be a Map', () => {
|
|
1291
|
-
expect(BUILDER_KEY_MAP).toBeInstanceOf(Map);
|
|
1292
|
-
});
|
|
1293
|
-
|
|
1294
|
-
it('should map builder functions to string keys', () => {
|
|
1295
|
-
expect(BUILDER_KEY_MAP.get(withLabel)).toBe('label');
|
|
1296
|
-
expect(BUILDER_KEY_MAP.get(withTooltip)).toBe('tooltips');
|
|
1297
|
-
expect(BUILDER_KEY_MAP.get(withAxisY)).toBe('axisY');
|
|
1298
|
-
expect(BUILDER_KEY_MAP.get(withAxisX)).toBe('axisX');
|
|
1299
|
-
});
|
|
1300
|
-
});
|
|
1301
|
-
|
|
1302
|
-
describe('getBuilderKey', () => {
|
|
1303
|
-
it('should return the key for a known builder', () => {
|
|
1304
|
-
expect(getBuilderKey(withLabel)).toBe('label');
|
|
1305
|
-
expect(getBuilderKey(withLabelPie)).toBe('label_pie');
|
|
1306
|
-
expect(getBuilderKey(withTooltip)).toBe('tooltips');
|
|
1307
|
-
expect(getBuilderKey(withTooltipPie)).toBe('tooltips_pie');
|
|
1308
|
-
expect(getBuilderKey(withAxisY)).toBe('axisY');
|
|
1309
|
-
expect(getBuilderKey(withTableOptions)).toBe('table_options');
|
|
1310
|
-
});
|
|
1311
|
-
|
|
1312
|
-
it('should return undefined for unknown builder', () => {
|
|
1313
|
-
const unknownBuilder = () => ({});
|
|
1314
|
-
expect(getBuilderKey(unknownBuilder)).toBeUndefined();
|
|
1315
|
-
});
|
|
1316
|
-
});
|
|
1317
|
-
|
|
1318
|
-
describe('getPresetForChart', () => {
|
|
1319
|
-
it('should return preset for known chart type', () => {
|
|
1320
|
-
const preset = getPresetForChart(CHART_TYPES.LINE_CHART);
|
|
1321
|
-
|
|
1322
|
-
expect(preset).toBeDefined();
|
|
1323
|
-
expect(Array.isArray(preset)).toBe(true);
|
|
1324
|
-
});
|
|
1325
|
-
|
|
1326
|
-
it('should include expected builders for line chart', () => {
|
|
1327
|
-
const preset = getPresetForChart(CHART_TYPES.LINE_CHART);
|
|
1328
|
-
|
|
1329
|
-
expect(preset).toContain(withLabel);
|
|
1330
|
-
expect(preset).toContain(withTooltip);
|
|
1331
|
-
expect(preset).toContain(withAxisY);
|
|
1332
|
-
expect(preset).toContain(withAxisX);
|
|
1333
|
-
expect(preset).toContain(withSubtitle);
|
|
1334
|
-
});
|
|
1335
|
-
|
|
1336
|
-
it('should include pie-specific builders for pie chart', () => {
|
|
1337
|
-
const preset = getPresetForChart(CHART_TYPES.PIE_CHART);
|
|
1338
|
-
|
|
1339
|
-
expect(preset).toContain(withLabelPie);
|
|
1340
|
-
expect(preset).toContain(withTooltipPie);
|
|
1341
|
-
expect(preset).not.toContain(withLabel);
|
|
1342
|
-
expect(preset).not.toContain(withTooltip);
|
|
1343
|
-
});
|
|
1344
|
-
|
|
1345
|
-
it('should include gauge-specific builders for gauge chart', () => {
|
|
1346
|
-
const preset = getPresetForChart(CHART_TYPES.GAUGE_CHART_ENHANCED);
|
|
1347
|
-
|
|
1348
|
-
expect(preset).toContain(withLabelGauge);
|
|
1349
|
-
expect(preset).toContain(withTooltipGauge);
|
|
1350
|
-
expect(preset).toContain(withGaugeGoal);
|
|
1351
|
-
expect(preset).toContain(withGaugeSegments);
|
|
1352
|
-
});
|
|
1353
|
-
|
|
1354
|
-
it('should return undefined for unknown chart type', () => {
|
|
1355
|
-
const preset = getPresetForChart('unknown-chart');
|
|
1356
|
-
expect(preset).toBeUndefined();
|
|
1357
|
-
});
|
|
1358
|
-
});
|
|
1359
|
-
|
|
1360
|
-
describe('buildSuboptionsForChart', () => {
|
|
1361
|
-
it('should build suboptions object for a chart type', () => {
|
|
1362
|
-
const result = buildSuboptionsForChart(CHART_TYPES.LINE_CHART);
|
|
1363
|
-
|
|
1364
|
-
expect(result).toBeDefined();
|
|
1365
|
-
expect(typeof result).toBe('object');
|
|
1366
|
-
});
|
|
1367
|
-
|
|
1368
|
-
it('should include expected keys for line chart', () => {
|
|
1369
|
-
const result = buildSuboptionsForChart(CHART_TYPES.LINE_CHART);
|
|
1370
|
-
|
|
1371
|
-
expect(result).toHaveProperty('label');
|
|
1372
|
-
expect(result).toHaveProperty('tooltips');
|
|
1373
|
-
expect(result).toHaveProperty('axisY');
|
|
1374
|
-
expect(result).toHaveProperty('axisX');
|
|
1375
|
-
});
|
|
1376
|
-
|
|
1377
|
-
it('should include pie-specific keys for pie chart', () => {
|
|
1378
|
-
const result = buildSuboptionsForChart(CHART_TYPES.PIE_CHART);
|
|
1379
|
-
|
|
1380
|
-
expect(result).toHaveProperty('label_pie');
|
|
1381
|
-
expect(result).toHaveProperty('tooltips_pie');
|
|
1382
|
-
expect(result).not.toHaveProperty('label');
|
|
1383
|
-
expect(result).not.toHaveProperty('tooltips');
|
|
1384
|
-
});
|
|
1385
|
-
|
|
1386
|
-
it('should return empty object for unknown chart type', () => {
|
|
1387
|
-
const result = buildSuboptionsForChart('unknown-chart');
|
|
1388
|
-
|
|
1389
|
-
expect(result).toEqual({});
|
|
1390
|
-
});
|
|
1391
|
-
|
|
1392
|
-
it('should pass config to builders', () => {
|
|
1393
|
-
const config = { CHART_TYPES };
|
|
1394
|
-
const result = buildSuboptionsForChart(CHART_TYPES.COLUMN_CHART, config);
|
|
1395
|
-
|
|
1396
|
-
// Should still work with config
|
|
1397
|
-
expect(result).toHaveProperty('table_options');
|
|
1398
|
-
});
|
|
1399
|
-
});
|
|
1400
|
-
|
|
1401
|
-
describe('buildSuboptions', () => {
|
|
1402
|
-
it('should build suboptions from an array of builders', () => {
|
|
1403
|
-
const result = buildSuboptions([withLabel, withTooltip]);
|
|
1404
|
-
|
|
1405
|
-
expect(Object.keys(result)).toHaveLength(2);
|
|
1406
|
-
expect(result).toHaveProperty('label');
|
|
1407
|
-
expect(result).toHaveProperty('tooltips');
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
it('should handle empty array', () => {
|
|
1411
|
-
const result = buildSuboptions([]);
|
|
1412
|
-
expect(result).toEqual({});
|
|
1413
|
-
});
|
|
1414
|
-
|
|
1415
|
-
it('should pass config to builders', () => {
|
|
1416
|
-
const result = buildSuboptions([withLabelGauge], { enableGaugeDynamicGoal: true });
|
|
1417
|
-
|
|
1418
|
-
expect(result).toHaveProperty('label_gauge');
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
it('should skip unknown builders', () => {
|
|
1422
|
-
const unknownBuilder = () => ({});
|
|
1423
|
-
const result = buildSuboptions([withLabel, unknownBuilder, withTooltip]);
|
|
1424
|
-
|
|
1425
|
-
expect(Object.keys(result)).toHaveLength(2);
|
|
1426
|
-
expect(result).toHaveProperty('label');
|
|
1427
|
-
expect(result).toHaveProperty('tooltips');
|
|
1428
|
-
});
|
|
1429
|
-
});
|
|
1430
|
-
|
|
1431
|
-
describe('getChartTypes', () => {
|
|
1432
|
-
it('should return array of chart types', () => {
|
|
1433
|
-
const result = getChartTypes();
|
|
1434
|
-
|
|
1435
|
-
expect(Array.isArray(result)).toBe(true);
|
|
1436
|
-
expect(result.length).toBeGreaterThan(0);
|
|
1437
|
-
});
|
|
1438
|
-
|
|
1439
|
-
it('should contain all expected chart types', () => {
|
|
1440
|
-
const result = getChartTypes();
|
|
1441
|
-
|
|
1442
|
-
expect(result).toContain('line-chart');
|
|
1443
|
-
expect(result).toContain('column-chart');
|
|
1444
|
-
expect(result).toContain('bar-chart');
|
|
1445
|
-
expect(result).toContain('pie-chart');
|
|
1446
|
-
expect(result).toContain('donut-chart');
|
|
1447
|
-
});
|
|
1448
|
-
});
|
|
1449
|
-
|
|
1450
|
-
describe('hasPreset', () => {
|
|
1451
|
-
it('should return true for chart types with presets', () => {
|
|
1452
|
-
expect(hasPreset(CHART_TYPES.LINE_CHART)).toBe(true);
|
|
1453
|
-
expect(hasPreset(CHART_TYPES.COLUMN_CHART)).toBe(true);
|
|
1454
|
-
expect(hasPreset(CHART_TYPES.PIE_CHART)).toBe(true);
|
|
1455
|
-
});
|
|
1456
|
-
|
|
1457
|
-
it('should return false for unknown chart types', () => {
|
|
1458
|
-
expect(hasPreset('unknown-chart')).toBe(false);
|
|
1459
|
-
expect(hasPreset('')).toBe(false);
|
|
1460
|
-
});
|
|
1461
|
-
});
|
|
1462
|
-
});
|
|
1463
|
-
|
|
1464
|
-
// =========================================================================
|
|
1465
|
-
// Helper Tests
|
|
1466
|
-
// =========================================================================
|
|
1467
|
-
|
|
1468
|
-
describe('Helpers', () => {
|
|
1469
|
-
describe('chartHasVerticalDataLabelsOption', () => {
|
|
1470
|
-
it('should return true for charts that support vertical labels', () => {
|
|
1471
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.COLUMN_CHART)).toBe(true);
|
|
1472
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.COLUMN_CHART_STACKED)).toBe(true);
|
|
1473
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.PIE_CHART)).toBe(true);
|
|
1474
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.SCATTER_CHART)).toBe(true);
|
|
1475
|
-
});
|
|
1476
|
-
|
|
1477
|
-
it('should return false for line charts', () => {
|
|
1478
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.LINE_CHART)).toBe(false);
|
|
1479
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.LINE_CHART_SMOOTH)).toBe(false);
|
|
1480
|
-
});
|
|
1481
|
-
|
|
1482
|
-
it('should return false for area charts', () => {
|
|
1483
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.AREA_CHART)).toBe(false);
|
|
1484
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.AREA_CHART_SMOOTH)).toBe(false);
|
|
1485
|
-
});
|
|
1486
|
-
|
|
1487
|
-
it('should return false for bar charts', () => {
|
|
1488
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.BAR_CHART)).toBe(false);
|
|
1489
|
-
expect(chartHasVerticalDataLabelsOption(CHART_TYPES.BAR_CHART_STACKED)).toBe(false);
|
|
1490
|
-
});
|
|
1491
|
-
});
|
|
1492
|
-
});
|
|
1493
|
-
|
|
1494
|
-
// =========================================================================
|
|
1495
|
-
// Index/Factory Tests
|
|
1496
|
-
// =========================================================================
|
|
1497
|
-
|
|
1498
|
-
describe('Index Exports and createDefaultSuboptions', () => {
|
|
1499
|
-
describe('createDefaultSuboptions', () => {
|
|
1500
|
-
it('should create a complete suboptions object', () => {
|
|
1501
|
-
const result = createDefaultSuboptions();
|
|
1502
|
-
|
|
1503
|
-
expect(result).toBeDefined();
|
|
1504
|
-
expect(typeof result).toBe('object');
|
|
1505
|
-
});
|
|
1506
|
-
|
|
1507
|
-
it('should include all expected suboption keys', () => {
|
|
1508
|
-
const result = createDefaultSuboptions();
|
|
1509
|
-
const expectedKeys = [
|
|
1510
|
-
'widget_library',
|
|
1511
|
-
'table_options',
|
|
1512
|
-
'table_options_transpose',
|
|
1513
|
-
'table_options_gauge',
|
|
1514
|
-
'table_design_options',
|
|
1515
|
-
'value',
|
|
1516
|
-
'range',
|
|
1517
|
-
'name',
|
|
1518
|
-
'subtitle',
|
|
1519
|
-
'chart',
|
|
1520
|
-
'chart_grid',
|
|
1521
|
-
'chart_forecast',
|
|
1522
|
-
'total_value_label_donut',
|
|
1523
|
-
'chart_position',
|
|
1524
|
-
'label',
|
|
1525
|
-
'label_pie',
|
|
1526
|
-
'label_gauge',
|
|
1527
|
-
'label_with_percentage',
|
|
1528
|
-
'label_with_percentage_percent_stacked',
|
|
1529
|
-
'axisY',
|
|
1530
|
-
'axisY_percent_stacked',
|
|
1531
|
-
'axisX',
|
|
1532
|
-
'ticks',
|
|
1533
|
-
'tooltips',
|
|
1534
|
-
'tooltips_pie',
|
|
1535
|
-
'tooltips_gauge',
|
|
1536
|
-
'negative_number_format',
|
|
1537
|
-
'delta_column',
|
|
1538
|
-
'delta_column_for_drill_down',
|
|
1539
|
-
'advanced',
|
|
1540
|
-
'legends',
|
|
1541
|
-
'gauge_goal',
|
|
1542
|
-
'gauge_segments',
|
|
1543
|
-
'gauge_is_absolute',
|
|
1544
|
-
];
|
|
1545
|
-
|
|
1546
|
-
expectedKeys.forEach(key => {
|
|
1547
|
-
expect(result).toHaveProperty(key);
|
|
1548
|
-
});
|
|
1549
|
-
});
|
|
1550
|
-
|
|
1551
|
-
it('should create 34 suboptions', () => {
|
|
1552
|
-
const result = createDefaultSuboptions();
|
|
1553
|
-
expect(Object.keys(result)).toHaveLength(34);
|
|
1554
|
-
});
|
|
1555
|
-
|
|
1556
|
-
it('should pass config to builders that need it', () => {
|
|
1557
|
-
const customSegments = [{ from: 0, to: 100, color: 'green', title: 'Good' }];
|
|
1558
|
-
|
|
1559
|
-
const result = createDefaultSuboptions({
|
|
1560
|
-
CHART_TYPES,
|
|
1561
|
-
enableGaugeDynamicGoal: true,
|
|
1562
|
-
defaultGaugeSegments: customSegments,
|
|
1563
|
-
});
|
|
1564
|
-
|
|
1565
|
-
// Gauge segments should use custom segments
|
|
1566
|
-
expect(result.gauge_segments.default_value).toEqual(customSegments);
|
|
1567
|
-
});
|
|
1568
|
-
|
|
1569
|
-
it('should create valid SuboptionDefinition for each suboption', () => {
|
|
1570
|
-
const result = createDefaultSuboptions();
|
|
1571
|
-
|
|
1572
|
-
Object.values(result).forEach(suboption => {
|
|
1573
|
-
expect(suboption).toHaveProperty('category_class');
|
|
1574
|
-
expect(suboption).toHaveProperty('category_label');
|
|
1575
|
-
expect(suboption).toHaveProperty('category_type');
|
|
1576
|
-
});
|
|
1577
|
-
});
|
|
1578
|
-
});
|
|
1579
|
-
|
|
1580
|
-
describe('Module exports', () => {
|
|
1581
|
-
it('should export all constants', () => {
|
|
1582
|
-
expect(options.CHART_TYPES).toBeDefined();
|
|
1583
|
-
expect(options.CHART_COLORS).toBeDefined();
|
|
1584
|
-
expect(options.SUBOPTIONS_FONTS).toBeDefined();
|
|
1585
|
-
expect(options.HIGHCHARTS_FONT_FAMILY).toBeDefined();
|
|
1586
|
-
expect(options.HIGHCHARTS_FONT_FAMILY_CSS).toBeDefined();
|
|
1587
|
-
expect(options.TOOLTIP_DEFAULT_SETTINGS).toBeDefined();
|
|
1588
|
-
expect(options.TOOLTIP_DEFAULT_OPTIONS).toBeDefined();
|
|
1589
|
-
expect(options.LABEL_DEFAULT_SETTINGS).toBeDefined();
|
|
1590
|
-
expect(options.LABEL_DEFAULT_OPTIONS).toBeDefined();
|
|
1591
|
-
expect(options.SUBOPTIONS_FONT_SIZE_VALUES).toBeDefined();
|
|
1592
|
-
expect(options.DEFAULT_CATEGORY_CLASS).toBeDefined();
|
|
1593
|
-
});
|
|
1594
|
-
|
|
1595
|
-
it('should export all element factories as functions', () => {
|
|
1596
|
-
expect(typeof options.createToggle).toBe('function');
|
|
1597
|
-
expect(typeof options.createCheckbox).toBe('function');
|
|
1598
|
-
expect(typeof options.createInput).toBe('function');
|
|
1599
|
-
expect(typeof options.createSelect).toBe('function');
|
|
1600
|
-
expect(typeof options.createRadio).toBe('function');
|
|
1601
|
-
expect(typeof options.createColorPicker).toBe('function');
|
|
1602
|
-
expect(typeof options.createDivider).toBe('function');
|
|
1603
|
-
expect(typeof options.createTextarea).toBe('function');
|
|
1604
|
-
expect(typeof options.createTag).toBe('function');
|
|
1605
|
-
expect(typeof options.createFontStylingGroup).toBe('function');
|
|
1606
|
-
expect(typeof options.createLabelStyleGroup).toBe('function');
|
|
1607
|
-
expect(typeof options.createTooltipStyleGroup).toBe('function');
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
it('should export all label builders as functions', () => {
|
|
1611
|
-
expect(typeof options.withLabel).toBe('function');
|
|
1612
|
-
expect(typeof options.withLabelPie).toBe('function');
|
|
1613
|
-
expect(typeof options.withLabelGauge).toBe('function');
|
|
1614
|
-
expect(typeof options.withLabelWithPercentage).toBe('function');
|
|
1615
|
-
expect(typeof options.withLabelWithPercentagePercentStacked).toBe('function');
|
|
1616
|
-
});
|
|
1617
|
-
|
|
1618
|
-
it('should export all tooltip builders as functions', () => {
|
|
1619
|
-
expect(typeof options.withTooltip).toBe('function');
|
|
1620
|
-
expect(typeof options.withTooltipPie).toBe('function');
|
|
1621
|
-
expect(typeof options.withTooltipGauge).toBe('function');
|
|
1622
|
-
});
|
|
1623
|
-
|
|
1624
|
-
it('should export all axis builders as functions', () => {
|
|
1625
|
-
expect(typeof options.withAxisY).toBe('function');
|
|
1626
|
-
expect(typeof options.withAxisYPercentStacked).toBe('function');
|
|
1627
|
-
expect(typeof options.withAxisX).toBe('function');
|
|
1628
|
-
});
|
|
1629
|
-
|
|
1630
|
-
it('should export all table builders as functions', () => {
|
|
1631
|
-
expect(typeof options.withTableOptions).toBe('function');
|
|
1632
|
-
expect(typeof options.withTableOptionsTranspose).toBe('function');
|
|
1633
|
-
expect(typeof options.withTableOptionsGauge).toBe('function');
|
|
1634
|
-
expect(typeof options.withTableDesignOptions).toBe('function');
|
|
1635
|
-
});
|
|
1636
|
-
|
|
1637
|
-
it('should export all chart config builders as functions', () => {
|
|
1638
|
-
expect(typeof options.withChart).toBe('function');
|
|
1639
|
-
expect(typeof options.withChartGrid).toBe('function');
|
|
1640
|
-
expect(typeof options.withChartForecast).toBe('function');
|
|
1641
|
-
expect(typeof options.withChartPosition).toBe('function');
|
|
1642
|
-
});
|
|
1643
|
-
|
|
1644
|
-
it('should export all other builders as functions', () => {
|
|
1645
|
-
expect(typeof options.withWidgetLibrary).toBe('function');
|
|
1646
|
-
expect(typeof options.withSubtitle).toBe('function');
|
|
1647
|
-
expect(typeof options.withName).toBe('function');
|
|
1648
|
-
expect(typeof options.withNegativeNumberFormat).toBe('function');
|
|
1649
|
-
expect(typeof options.withValue).toBe('function');
|
|
1650
|
-
expect(typeof options.withRange).toBe('function');
|
|
1651
|
-
expect(typeof options.withTicks).toBe('function');
|
|
1652
|
-
expect(typeof options.withLegends).toBe('function');
|
|
1653
|
-
expect(typeof options.withDeltaColumn).toBe('function');
|
|
1654
|
-
expect(typeof options.withDeltaColumnForDrillDown).toBe('function');
|
|
1655
|
-
expect(typeof options.withAdvanced).toBe('function');
|
|
1656
|
-
expect(typeof options.withTotalValueLabelDonut).toBe('function');
|
|
1657
|
-
expect(typeof options.withGaugeGoal).toBe('function');
|
|
1658
|
-
expect(typeof options.withGaugeSegments).toBe('function');
|
|
1659
|
-
expect(typeof options.withGaugeIsAbsolute).toBe('function');
|
|
1660
|
-
});
|
|
1661
|
-
|
|
1662
|
-
it('should export preset utilities', () => {
|
|
1663
|
-
expect(options.CHART_PRESETS).toBeDefined();
|
|
1664
|
-
expect(options.BUILDER_KEY_MAP).toBeDefined();
|
|
1665
|
-
expect(typeof options.getBuilderKey).toBe('function');
|
|
1666
|
-
expect(typeof options.getPresetForChart).toBe('function');
|
|
1667
|
-
expect(typeof options.buildSuboptionsForChart).toBe('function');
|
|
1668
|
-
expect(typeof options.buildSuboptions).toBe('function');
|
|
1669
|
-
expect(typeof options.getChartTypes).toBe('function');
|
|
1670
|
-
expect(typeof options.hasPreset).toBe('function');
|
|
1671
|
-
});
|
|
1672
|
-
|
|
1673
|
-
it('should export helper functions', () => {
|
|
1674
|
-
expect(typeof options.chartHasVerticalDataLabelsOption).toBe('function');
|
|
1675
|
-
});
|
|
1676
|
-
|
|
1677
|
-
it('should export reusable disabled conditions', () => {
|
|
1678
|
-
expect(options.LABEL_DISABLED_CONDITION).toBeDefined();
|
|
1679
|
-
expect(options.LABEL_PIE_DISABLED_CONDITION).toBeDefined();
|
|
1680
|
-
expect(options.TOOLTIP_DISABLED_CONDITION).toBeDefined();
|
|
1681
|
-
expect(options.TOOLTIP_PIE_DISABLED_CONDITION).toBeDefined();
|
|
1682
|
-
});
|
|
1683
|
-
|
|
1684
|
-
it('should export reusable elements', () => {
|
|
1685
|
-
expect(options.LABEL_SHOW_TOGGLE).toBeDefined();
|
|
1686
|
-
expect(options.LABEL_PIE_SHOW_TOGGLE).toBeDefined();
|
|
1687
|
-
expect(options.LABEL_OVERLAP_TOGGLE).toBeDefined();
|
|
1688
|
-
expect(options.TOOLTIP_SHOW_TOGGLE).toBeDefined();
|
|
1689
|
-
expect(options.TOOLTIP_PIE_SHOW_TOGGLE).toBeDefined();
|
|
1690
|
-
expect(options.GAUGE_SHOW_TOGGLE).toBeDefined();
|
|
1691
|
-
});
|
|
1692
|
-
|
|
1693
|
-
it('should export createDefaultSuboptions', () => {
|
|
1694
|
-
expect(typeof options.createDefaultSuboptions).toBe('function');
|
|
1695
|
-
});
|
|
1696
|
-
});
|
|
1697
|
-
});
|
|
1698
|
-
});
|