Skip to content

Commit

Permalink
fix: customize tab on heatmap chart is blank (#23243)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lily Kuang authored Mar 1, 2023
1 parent d3e698e commit 1f3eb56
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import React from 'react';
import userEvent from '@testing-library/user-event';
import { render, screen } from 'spec/helpers/testing-library';
import {
DatasourceType,
Expand Down Expand Up @@ -104,5 +105,43 @@ describe('ControlPanelsContainer', () => {
expect(
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(4);
expect(screen.getByRole('tab', { name: /customize/i })).toBeInTheDocument();
userEvent.click(screen.getByRole('tab', { name: /customize/i }));
expect(
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(5);
});

test('renders ControlPanelSections no Customize Tab', async () => {
getChartControlPanelRegistry().registerValue('table', {
controlPanelSections: [
{
label: t('GROUP BY'),
description: t(
'Use this section if you want a query that aggregates',
),
expanded: true,
controlSetRows: [
['groupby'],
['metrics'],
['percent_metrics'],
['timeseries_limit_metric', 'row_limit'],
['include_time', 'order_desc'],
],
},
{
label: t('Options'),
expanded: true,
controlSetRows: [],
},
],
});
render(<ControlPanelsContainer {...getDefaultProps()} />, {
useRedux: true,
});
expect(screen.queryByText(/customize/i)).not.toBeInTheDocument();
expect(
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function getState(
)
) {
querySections.push(section);
} else {
} else if (section.controlSetRows.length > 0) {
customizeSections.push(section);
}
});
Expand Down

0 comments on commit 1f3eb56

Please sign in to comment.