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


##########
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:
   Good call, added in 59f70ee. It seeds a scalar `time_compare: 'inherit'` and 
asserts it serializes to null on the target viz, so the coercion path through 
`getControlsState` is covered now.



-- 
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