@gooddata/sdk-ui-dashboard 11.53.0-alpha.6 → 11.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/esm/__version.d.ts +1 -1
  2. package/esm/__version.d.ts.map +1 -1
  3. package/esm/__version.js +1 -1
  4. package/esm/index.d.ts +3 -3
  5. package/esm/index.d.ts.map +1 -1
  6. package/esm/index.js +2 -2
  7. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.d.ts.map +1 -1
  8. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.js +3 -1
  9. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.d.ts.map +1 -1
  10. package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.js +3 -1
  11. package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.d.ts.map +1 -1
  12. package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.js +3 -1
  13. package/esm/model/commandHandlers/dashboard/exportToTabularHandler.d.ts.map +1 -1
  14. package/esm/model/commandHandlers/dashboard/exportToTabularHandler.js +5 -3
  15. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.d.ts.map +1 -1
  16. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js +9 -2
  17. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts +12 -0
  18. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts.map +1 -0
  19. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.js +25 -0
  20. package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.d.ts.map +1 -1
  21. package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.js +4 -3
  22. package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.d.ts.map +1 -1
  23. package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.js +3 -1
  24. package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.d.ts.map +1 -1
  25. package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.js +4 -2
  26. package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.d.ts.map +1 -1
  27. package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.js +7 -1
  28. package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.d.ts.map +1 -1
  29. package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.js +3 -1
  30. package/esm/model/store/config/configSelectors.d.ts +6 -0
  31. package/esm/model/store/config/configSelectors.d.ts.map +1 -1
  32. package/esm/model/store/config/configSelectors.js +8 -0
  33. package/esm/model/store/meta/metaSelectors.d.ts +16 -0
  34. package/esm/model/store/meta/metaSelectors.d.ts.map +1 -1
  35. package/esm/model/store/meta/metaSelectors.js +28 -1
  36. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts +1 -1
  37. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts.map +1 -1
  38. package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.js +6 -1
  39. package/esm/presentation/automations/alerting/state/useAlertFormState.d.ts.map +1 -1
  40. package/esm/presentation/automations/alerting/state/useAlertFormState.js +6 -2
  41. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.d.ts.map +1 -1
  42. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.js +29 -3
  43. package/esm/presentation/automations/contexts/AutomationsContext.d.ts +39 -0
  44. package/esm/presentation/automations/contexts/AutomationsContext.d.ts.map +1 -1
  45. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
  46. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +33 -10
  47. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts +15 -0
  48. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts.map +1 -0
  49. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.js +58 -0
  50. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts +52 -0
  51. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts.map +1 -0
  52. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.js +46 -0
  53. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts +47 -0
  54. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts.map +1 -0
  55. package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.js +90 -0
  56. package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.d.ts.map +1 -1
  57. package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.js +21 -0
  58. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts +2 -1
  59. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts.map +1 -1
  60. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts +5 -2
  61. package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts.map +1 -1
  62. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts +19 -2
  63. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts.map +1 -1
  64. package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.js +35 -2
  65. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts +9 -1
  66. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts.map +1 -1
  67. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.js +10 -1
  68. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.d.ts.map +1 -1
  69. package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.js +14 -2
  70. package/esm/presentation/automations/scheduledEmail/types.d.ts +64 -0
  71. package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
  72. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts +12 -1
  73. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts.map +1 -1
  74. package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js +17 -2
  75. package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.d.ts.map +1 -1
  76. package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.js +3 -1
  77. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.d.ts.map +1 -1
  78. package/esm/presentation/dashboardSettingsDialog/TimezoneOption.js +5 -6
  79. package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.d.ts.map +1 -1
  80. package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.js +6 -1
  81. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +48 -4
  82. package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
  83. package/esm/presentation/localization/bundles/en-US.localization-bundle.js +51 -7
  84. package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts +1 -1
  85. package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts.map +1 -1
  86. package/esm/presentation/timezoneDialog/TimezoneDialog.js +7 -6
  87. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.d.ts.map +1 -1
  88. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js +6 -2
  89. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts +4 -3
  90. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts.map +1 -1
  91. package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.js +10 -9
  92. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
  93. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +6 -1
  94. package/esm/sdk-ui-dashboard.d.ts +134 -3
  95. package/package.json +21 -21
  96. package/styles/css/main.css +29 -0
  97. package/styles/css/main.css.map +1 -1
  98. package/styles/css/scheduleTimezone.css +30 -0
  99. package/styles/css/scheduleTimezone.css.map +1 -0
  100. package/styles/scss/main.scss +1 -0
  101. package/styles/scss/scheduleTimezone.scss +37 -0
  102. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts +0 -2
  103. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts.map +0 -1
  104. package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.js +0 -39
  105. package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts +0 -2
  106. package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts.map +0 -1
  107. package/esm/presentation/automations/connectors/AlertingConnector.test.js +0 -201
  108. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts +0 -2
  109. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts.map +0 -1
  110. package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.js +0 -225
  111. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts +0 -2
  112. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts.map +0 -1
  113. package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.js +0 -95
  114. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts +0 -2
  115. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts.map +0 -1
  116. package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.js +0 -185
  117. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts +0 -2
  118. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts.map +0 -1
  119. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js +0 -175
  120. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts +0 -2
  121. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts.map +0 -1
  122. package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.js +0 -48
  123. package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts +0 -2
  124. package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts.map +0 -1
  125. package/esm/presentation/automations/contexts/AutomationsContext.test.js +0 -9
  126. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts +0 -2
  127. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts.map +0 -1
  128. package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.js +0 -159
  129. package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts +0 -2
  130. package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts.map +0 -1
  131. package/esm/presentation/export/DefaultDashboardExportVariables.test.js +0 -58
  132. package/esm/presentation/widget/insight/LayeredTableView.test.d.ts +0 -2
  133. package/esm/presentation/widget/insight/LayeredTableView.test.d.ts.map +0 -1
  134. package/esm/presentation/widget/insight/LayeredTableView.test.js +0 -149
  135. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts +0 -2
  136. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts.map +0 -1
  137. package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.js +0 -124
  138. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts +0 -2
  139. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts.map +0 -1
  140. package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.js +0 -139
  141. package/esm/presentation/widget/insight/insightToTable.test.d.ts +0 -2
  142. package/esm/presentation/widget/insight/insightToTable.test.d.ts.map +0 -1
  143. package/esm/presentation/widget/insight/insightToTable.test.js +0 -325
@@ -1,325 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
- import { describe, expect, it } from "vitest";
3
- import { idRef, insightVisualizationType, newAttribute, newMeasure, } from "@gooddata/sdk-model";
4
- import { BucketNames, VisualizationTypes } from "@gooddata/sdk-ui";
5
- import { convertInsightToLayerTables, convertInsightToTableDefinition } from "./insightToTable.js";
6
- // ---------------------------------------------------------------------------
7
- // Helpers
8
- // ---------------------------------------------------------------------------
9
- function createDisplayForm(id, attributeId, { isDefault, isPrimary } = {}) {
10
- return {
11
- type: "displayForm",
12
- title: id,
13
- description: "",
14
- uri: `/${id}`,
15
- id,
16
- ref: idRef(id, "displayForm"),
17
- production: true,
18
- deprecated: false,
19
- unlisted: false,
20
- attribute: idRef(attributeId, "attribute"),
21
- ...(isDefault ? { isDefault: true } : {}),
22
- ...(isPrimary ? { isPrimary: true } : {}),
23
- };
24
- }
25
- function createCatalogAttribute(attributeId, displayForms) {
26
- return {
27
- type: "attribute",
28
- attribute: {
29
- type: "attribute",
30
- title: attributeId,
31
- description: "",
32
- uri: `/${attributeId}`,
33
- id: attributeId,
34
- ref: idRef(attributeId, "attribute"),
35
- production: true,
36
- deprecated: false,
37
- unlisted: false,
38
- displayForms,
39
- },
40
- defaultDisplayForm: displayForms[0],
41
- displayForms,
42
- geoPinDisplayForms: [],
43
- groups: [],
44
- };
45
- }
46
- function createInsight(visualizationUrl, buckets, layers) {
47
- return {
48
- insight: {
49
- title: "Test Insight",
50
- visualizationUrl,
51
- buckets,
52
- filters: [],
53
- sorts: [],
54
- properties: {},
55
- identifier: "test",
56
- uri: "/test",
57
- ref: idRef("test"),
58
- ...(layers ? { layers } : {}),
59
- },
60
- };
61
- }
62
- function createLayer(id, type, buckets, name) {
63
- return { id, type, buckets, ...(name ? { name } : {}) };
64
- }
65
- // ---------------------------------------------------------------------------
66
- // Tests — convertInsightToLayerTables
67
- // ---------------------------------------------------------------------------
68
- describe("convertInsightToLayerTables", () => {
69
- const defaultLabel = createDisplayForm("label.default", "attr", { isDefault: true });
70
- const areaLabel = createDisplayForm("label.area", "attr");
71
- const locationLabel = createDisplayForm("label.location", "attr");
72
- const catalogAttributes = [createCatalogAttribute("attr", [defaultLabel, areaLabel, locationLabel])];
73
- it("returns undefined for non-geo insights", () => {
74
- const insight = createInsight("local:bar", [
75
- {
76
- localIdentifier: BucketNames.ATTRIBUTE,
77
- items: [newAttribute(idRef("label.area", "displayForm"))],
78
- },
79
- ]);
80
- const result = convertInsightToLayerTables(insight, {
81
- settings: { enableGeoArea: true, enableNewGeoPushpin: true },
82
- catalogAttributes,
83
- });
84
- expect(result).toBeUndefined();
85
- });
86
- it("returns undefined when geo flags are off (legacy)", () => {
87
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
88
- {
89
- localIdentifier: BucketNames.LOCATION,
90
- items: [newAttribute(idRef("label.location", "displayForm"))],
91
- },
92
- ]);
93
- // No enableNewGeoPushpin flag
94
- const result = convertInsightToLayerTables(insight, {
95
- settings: {},
96
- catalogAttributes,
97
- });
98
- expect(result).toBeUndefined();
99
- });
100
- it("returns single-element array for single-layer new-geo pushpin", () => {
101
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
102
- {
103
- localIdentifier: BucketNames.LOCATION,
104
- items: [newAttribute(idRef("label.location", "displayForm"))],
105
- },
106
- {
107
- localIdentifier: BucketNames.MEASURES,
108
- items: [newMeasure(idRef("measure1"))],
109
- },
110
- ]);
111
- const result = convertInsightToLayerTables(insight, {
112
- settings: { enableGeoChartA11yImprovements: true, enableNewGeoPushpin: true },
113
- catalogAttributes,
114
- });
115
- expect(result).toBeDefined();
116
- expect(result).toHaveLength(1);
117
- expect(result[0].layerId).toBe("root");
118
- expect(result[0].layerType).toBe("pushpin");
119
- expect(insightVisualizationType(result[0].tableInsight)).toBe("table");
120
- });
121
- it("returns single-element array for single-layer new-geo area", () => {
122
- const insight = createInsight(`local:${VisualizationTypes.CHOROPLETH}`, [
123
- {
124
- localIdentifier: BucketNames.AREA,
125
- items: [newAttribute(idRef("label.area", "displayForm"))],
126
- },
127
- ]);
128
- const result = convertInsightToLayerTables(insight, {
129
- settings: { enableGeoChartA11yImprovements: true, enableGeoArea: true },
130
- catalogAttributes,
131
- });
132
- expect(result).toBeDefined();
133
- expect(result).toHaveLength(1);
134
- expect(result[0].layerId).toBe("root");
135
- expect(result[0].layerType).toBe("area");
136
- });
137
- it("returns root + N elements for N additional layers", () => {
138
- const layer1 = createLayer("layer-1", "pushpin", [
139
- {
140
- localIdentifier: BucketNames.LOCATION,
141
- items: [newAttribute(idRef("label.location", "displayForm"))],
142
- },
143
- {
144
- localIdentifier: BucketNames.MEASURES,
145
- items: [newMeasure(idRef("m1"))],
146
- },
147
- ], "Cities");
148
- const layer2 = createLayer("layer-2", "area", [
149
- {
150
- localIdentifier: BucketNames.AREA,
151
- items: [newAttribute(idRef("label.area", "displayForm"))],
152
- },
153
- ], "Regions");
154
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
155
- {
156
- localIdentifier: BucketNames.LOCATION,
157
- items: [newAttribute(idRef("label.location", "displayForm"))],
158
- },
159
- ], [layer1, layer2]);
160
- const result = convertInsightToLayerTables(insight, {
161
- settings: { enableGeoChartA11yImprovements: true, enableNewGeoPushpin: true },
162
- catalogAttributes,
163
- });
164
- expect(result).toHaveLength(3);
165
- // Root
166
- expect(result[0].layerId).toBe("root");
167
- expect(result[0].layerName).toBe("Test Insight");
168
- expect(result[0].layerType).toBe("pushpin");
169
- // Layer 1
170
- expect(result[1].layerId).toBe("layer-1");
171
- expect(result[1].layerName).toBe("Cities");
172
- expect(result[1].layerType).toBe("pushpin");
173
- // Layer 2
174
- expect(result[2].layerId).toBe("layer-2");
175
- expect(result[2].layerName).toBe("Regions");
176
- expect(result[2].layerType).toBe("area");
177
- });
178
- it("each tableInsight has visualizationUrl local:table", () => {
179
- const layer = createLayer("layer-1", "area", [
180
- {
181
- localIdentifier: BucketNames.AREA,
182
- items: [newAttribute(idRef("label.area", "displayForm"))],
183
- },
184
- ]);
185
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
186
- {
187
- localIdentifier: BucketNames.LOCATION,
188
- items: [newAttribute(idRef("label.location", "displayForm"))],
189
- },
190
- ], [layer]);
191
- const result = convertInsightToLayerTables(insight, {
192
- settings: { enableGeoChartA11yImprovements: true, enableNewGeoPushpin: true },
193
- catalogAttributes,
194
- });
195
- result.forEach((def) => {
196
- expect(def.tableInsight.insight.visualizationUrl).toBe("local:table");
197
- });
198
- });
199
- it("falls back to layer.id when layer has no name", () => {
200
- const layer = createLayer("unnamed-layer", "pushpin", [
201
- {
202
- localIdentifier: BucketNames.LOCATION,
203
- items: [newAttribute(idRef("label.location", "displayForm"))],
204
- },
205
- ]);
206
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
207
- {
208
- localIdentifier: BucketNames.LOCATION,
209
- items: [newAttribute(idRef("label.location", "displayForm"))],
210
- },
211
- ], [layer]);
212
- const result = convertInsightToLayerTables(insight, {
213
- settings: { enableGeoChartA11yImprovements: true, enableNewGeoPushpin: true },
214
- catalogAttributes,
215
- });
216
- expect(result[1].layerName).toBe("unnamed-layer");
217
- });
218
- it("maps choropleth root visualization to area layer type", () => {
219
- const layer = createLayer("layer-1", "area", [
220
- {
221
- localIdentifier: BucketNames.AREA,
222
- items: [newAttribute(idRef("label.area", "displayForm"))],
223
- },
224
- ], "Choropleth Layer");
225
- const insight = createInsight(`local:${VisualizationTypes.CHOROPLETH}`, [
226
- {
227
- localIdentifier: BucketNames.AREA,
228
- items: [newAttribute(idRef("label.area", "displayForm"))],
229
- },
230
- ], [layer]);
231
- const result = convertInsightToLayerTables(insight, {
232
- settings: { enableGeoChartA11yImprovements: true, enableGeoArea: true },
233
- catalogAttributes,
234
- });
235
- expect(result[0].layerType).toBe("area");
236
- expect(result[1].layerType).toBe("area");
237
- });
238
- it("attribute-only layers produce valid tables", () => {
239
- const insight = createInsight(`local:${VisualizationTypes.CHOROPLETH}`, [
240
- {
241
- localIdentifier: BucketNames.AREA,
242
- items: [newAttribute(idRef("label.area", "displayForm"))],
243
- },
244
- ]);
245
- const result = convertInsightToLayerTables(insight, {
246
- settings: { enableGeoChartA11yImprovements: true, enableGeoArea: true },
247
- catalogAttributes,
248
- });
249
- expect(result).toHaveLength(1);
250
- const tableInsight = result[0].tableInsight;
251
- expect(tableInsight.insight.visualizationUrl).toBe("local:table");
252
- // Should have attribute bucket with the area attribute
253
- const attrBucket = tableInsight.insight.buckets.find((b) => b.localIdentifier === BucketNames.ATTRIBUTE);
254
- expect(attrBucket).toBeDefined();
255
- expect(attrBucket.items.length).toBeGreaterThan(0);
256
- });
257
- it("includes COLOR bucket measures in layered table output", () => {
258
- const insight = createInsight(`local:${VisualizationTypes.CHOROPLETH}`, [
259
- {
260
- localIdentifier: BucketNames.AREA,
261
- items: [newAttribute(idRef("label.area", "displayForm"))],
262
- },
263
- {
264
- localIdentifier: BucketNames.COLOR,
265
- items: [newMeasure(idRef("m-color"))],
266
- },
267
- ]);
268
- const result = convertInsightToLayerTables(insight, {
269
- settings: { enableGeoChartA11yImprovements: true, enableGeoArea: true },
270
- catalogAttributes,
271
- });
272
- const measuresBucket = result?.[0].tableInsight.insight.buckets.find((bucket) => bucket.localIdentifier === BucketNames.MEASURES);
273
- expect(measuresBucket).toBeDefined();
274
- expect(measuresBucket?.items).toHaveLength(1);
275
- });
276
- it("skips unsupported additional layer types", () => {
277
- const unsupportedLayer = createLayer("layer-unsupported", "heatmap", [
278
- {
279
- localIdentifier: BucketNames.MEASURES,
280
- items: [newMeasure(idRef("m-unsupported"))],
281
- },
282
- ]);
283
- const insight = createInsight(`local:${VisualizationTypes.PUSHPIN}`, [
284
- {
285
- localIdentifier: BucketNames.LOCATION,
286
- items: [newAttribute(idRef("label.location", "displayForm"))],
287
- },
288
- ], [unsupportedLayer]);
289
- const result = convertInsightToLayerTables(insight, {
290
- settings: { enableGeoChartA11yImprovements: true, enableNewGeoPushpin: true },
291
- catalogAttributes,
292
- });
293
- expect(result).toHaveLength(1);
294
- expect(result?.[0].layerId).toBe("root");
295
- });
296
- });
297
- // ---------------------------------------------------------------------------
298
- // Regression — convertInsightToTableDefinition unchanged
299
- // ---------------------------------------------------------------------------
300
- describe("convertInsightToTableDefinition (regression)", () => {
301
- it("converts a bar chart to table", () => {
302
- const insight = createInsight("local:bar", [
303
- {
304
- localIdentifier: BucketNames.MEASURES,
305
- items: [newMeasure(idRef("m1"))],
306
- },
307
- {
308
- localIdentifier: BucketNames.VIEW,
309
- items: [newAttribute(idRef("a1", "displayForm"))],
310
- },
311
- ]);
312
- const result = convertInsightToTableDefinition(insight);
313
- expect(insightVisualizationType(result)).toBe("table");
314
- });
315
- it("returns original for table insight", () => {
316
- const insight = createInsight("local:table", [
317
- {
318
- localIdentifier: BucketNames.MEASURES,
319
- items: [newMeasure(idRef("m1"))],
320
- },
321
- ]);
322
- const result = convertInsightToTableDefinition(insight);
323
- expect(result).toBe(insight);
324
- });
325
- });