michael-s-molina commented on code in PR #28312:
URL: https://github.com/apache/superset/pull/28312#discussion_r1587502879
##########
superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx:
##########
@@ -144,4 +144,41 @@ describe('ControlPanelsContainer', () => {
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(2);
});
+
+ test('hide ControlPanelSections when its visibility is false', async () => {
+ getChartControlPanelRegistry().registerValue('table', {
+ controlPanelSections: [
+ {
+ label: t('Advanced analytics'),
+ description: t('Advanced analytical post processin'),
Review Comment:
```suggestion
description: t('Advanced analytics post processing'),
```
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/showIfTimeSeries.ts:
##########
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { isAdhocColumn, isPhysicalColumn } from '@superset-ui/core';
+import type { ColumnMeta, ControlPanelsContainerProps } from '../types';
+
+export default function showIfTimeSeries({
Review Comment:
Can we rename this to `showTimeRelatedControls`?
##########
superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx:
##########
@@ -144,4 +144,41 @@ describe('ControlPanelsContainer', () => {
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(2);
});
+
+ test('hide ControlPanelSections when its visibility is false', async () => {
Review Comment:
You're also testing if the panel is displayed when the visibility is `true`.
```suggestion
test('visibility of panels is correctly applied', async () => {
```
##########
superset-frontend/packages/superset-ui-chart-controls/test/utils/showIfTimeSeries.test.ts:
##########
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { showIfTimeSeries } from '../../src';
+
+const mockData = {
+ actions: {
+ setDatasource: jest.fn(),
+ },
+ controls: {
+ x_axis: {
+ type: 'SelectControl' as const,
+ value: 'not_temporal',
+ options: [
+ { column_name: 'not_temporal', is_dttm: false },
+ { column_name: 'ds', is_dttm: true },
+ ],
+ },
+ },
+ exportState: {},
+ form_data: {
+ datasource: '22__table',
+ viz_type: 'table',
+ },
+};
+
+describe('showIfTimeSeries', () => {
Review Comment:
Can you avoid `describe`?
--
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]