@gooddata/sdk-ui-dashboard 11.53.0-alpha.6 → 11.53.0-alpha.7
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportToTabularHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportToTabularHandler.js +5 -3
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js +9 -2
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts +12 -0
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts.map +1 -0
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.js +25 -0
- package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.js +4 -3
- package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.js +3 -1
- package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.js +4 -2
- package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.js +7 -1
- package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.js +3 -1
- package/esm/model/store/config/configSelectors.d.ts +6 -0
- package/esm/model/store/config/configSelectors.d.ts.map +1 -1
- package/esm/model/store/config/configSelectors.js +8 -0
- package/esm/model/store/meta/metaSelectors.d.ts +16 -0
- package/esm/model/store/meta/metaSelectors.d.ts.map +1 -1
- package/esm/model/store/meta/metaSelectors.js +28 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.js +6 -1
- package/esm/presentation/automations/alerting/state/useAlertFormState.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/state/useAlertFormState.js +6 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.js +29 -3
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts +39 -0
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +33 -10
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts +15 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.js +58 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts +52 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.js +46 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts +47 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.js +90 -0
- package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.js +21 -0
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts +2 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts +5 -2
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts +19 -2
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.js +35 -2
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts +9 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.js +10 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.js +14 -2
- package/esm/presentation/automations/scheduledEmail/types.d.ts +64 -0
- package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts +12 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js +17 -2
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.js +3 -1
- package/esm/presentation/dashboardSettingsDialog/TimezoneOption.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/TimezoneOption.js +5 -6
- package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.d.ts.map +1 -1
- package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.js +6 -1
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +48 -4
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-US.localization-bundle.js +51 -7
- package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts +1 -1
- package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts.map +1 -1
- package/esm/presentation/timezoneDialog/TimezoneDialog.js +7 -6
- package/esm/presentation/topBar/menuButton/useDefaultMenuItems.d.ts.map +1 -1
- package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js +6 -2
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts +4 -3
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts.map +1 -1
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.js +10 -9
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +6 -1
- package/esm/sdk-ui-dashboard.d.ts +134 -3
- package/package.json +21 -21
- package/styles/css/main.css +29 -0
- package/styles/css/main.css.map +1 -1
- package/styles/css/scheduleTimezone.css +30 -0
- package/styles/css/scheduleTimezone.css.map +1 -0
- package/styles/scss/main.scss +1 -0
- package/styles/scss/scheduleTimezone.scss +37 -0
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts +0 -2
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts.map +0 -1
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.js +0 -39
- package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/AlertingConnector.test.js +0 -201
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.js +0 -225
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.js +0 -95
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.js +0 -185
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js +0 -175
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.js +0 -48
- package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts +0 -2
- package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/contexts/AutomationsContext.test.js +0 -9
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts +0 -2
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts.map +0 -1
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.js +0 -159
- package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts +0 -2
- package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts.map +0 -1
- package/esm/presentation/export/DefaultDashboardExportVariables.test.js +0 -58
- package/esm/presentation/widget/insight/LayeredTableView.test.d.ts +0 -2
- package/esm/presentation/widget/insight/LayeredTableView.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/LayeredTableView.test.js +0 -149
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts +0 -2
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.js +0 -124
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts +0 -2
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.js +0 -139
- package/esm/presentation/widget/insight/insightToTable.test.d.ts +0 -2
- package/esm/presentation/widget/insight/insightToTable.test.d.ts.map +0 -1
- 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
|
-
});
|