sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3431742332


##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +356,52 @@ describe('should collect control values and create SFD', 
() => {
     ]);
   });
 
+  test('strips inherit/custom time shifts when target viz does not support 
them', () => {
+    // Table/Big Number period-over-period offer "inherit" and "custom" time
+    // shifts; the timeseries advanced-analytics target (target_viz) does not.
+    // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+    const store = {
+      ...sourceMockStore,
+      form_data: {
+        ...sourceMockFormData,
+        time_compare: ['1 year ago', 'inherit', 'custom'],
+      },
+    };
+    const sfd = new StandardizedFormData(store.form_data);
+    const { formData } = sfd.transform('target_viz', store);
+    // the free-form delta survives, the special markers are dropped
+    expect(formData.time_compare).toEqual(['1 year ago']);
+  });

Review Comment:
   These tests pass `time_compare` as an array, but Table/Big Number store it 
as a scalar string and rely on the scalar→array coercion in `getControlState` 
before this strip runs. Can we add a case seeding `time_compare: 'inherit'` 
(scalar) so that path is covered too?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to