Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dashboard): update Edit Dashboard side panel tabs #20337

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* 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 React from 'react';
import { render, screen } from 'spec/helpers/testing-library';
import BuilderComponentPane from '.';

jest.mock('src/dashboard/containers/SliceAdder');

describe('BuilderComponentPane', () => {
michael-s-molina marked this conversation as resolved.
Show resolved Hide resolved
const props = { isStandalone: false, topOffset: 115 };
michael-s-molina marked this conversation as resolved.
Show resolved Hide resolved
render(<BuilderComponentPane {...props} />);

test('BuilderComponentPane has correct tabs in correct order', () => {
const tabs = screen.getAllByRole('tab');
expect(tabs).toHaveLength(2);
expect(tabs[0]).toHaveTextContent('Charts');
expect(tabs[1]).toHaveTextContent('Layout Elements');
expect(screen.getByRole('tab', { selected: true })).toHaveTextContent(
'Charts',
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import { ParentSize } from '@vx/responsive';

import { t, styled } from '@superset-ui/core';

import NewColumn from './gridComponents/new/NewColumn';
import NewDivider from './gridComponents/new/NewDivider';
import NewHeader from './gridComponents/new/NewHeader';
import NewRow from './gridComponents/new/NewRow';
import NewTabs from './gridComponents/new/NewTabs';
import NewMarkdown from './gridComponents/new/NewMarkdown';
import SliceAdder from '../containers/SliceAdder';
import dashboardComponents from '../../visualizations/presets/dashboardComponents';
import NewDynamicComponent from './gridComponents/new/NewDynamicComponent';
import SliceAdder from 'src/dashboard/containers/SliceAdder';
import dashboardComponents from 'src/visualizations/presets/dashboardComponents';
import NewColumn from '../gridComponents/new/NewColumn';
import NewDivider from '../gridComponents/new/NewDivider';
import NewHeader from '../gridComponents/new/NewHeader';
import NewRow from '../gridComponents/new/NewRow';
import NewTabs from '../gridComponents/new/NewTabs';
import NewMarkdown from '../gridComponents/new/NewMarkdown';
import NewDynamicComponent from '../gridComponents/new/NewDynamicComponent';

export interface BCPProps {
isStandalone: boolean;
Expand Down Expand Up @@ -101,7 +101,18 @@ const BuilderComponentPane: React.FC<BCPProps> = ({
className="tabs-components"
data-test="dashboard-builder-component-pane-tabs-navigation"
>
<Tabs.TabPane key={1} tab={t('Components')}>
<Tabs.TabPane
key={1}
tab={t('Charts')}
className="tab-charts"
>
<SliceAdder
height={
height + (isSticky ? SUPERSET_HEADER_HEIGHT : 0)
}
/>
</Tabs.TabPane>
<Tabs.TabPane key={2} tab={t('Layout Elements')}>
michael-s-molina marked this conversation as resolved.
Show resolved Hide resolved
<NewTabs />
<NewRow />
<NewColumn />
Expand All @@ -117,17 +128,6 @@ const BuilderComponentPane: React.FC<BCPProps> = ({
/>
))}
</Tabs.TabPane>
<Tabs.TabPane
key={2}
tab={t('Charts')}
className="tab-charts"
>
<SliceAdder
height={
height + (isSticky ? SUPERSET_HEADER_HEIGHT : 0)
}
/>
</Tabs.TabPane>
</BuilderComponentPaneTabs>
</div>
);
Expand Down