mirror of
https://github.com/apache/superset.git
synced 2026-08-05 21:42:48 +00:00
fix: address bito review nits (mockAntdWithDesktopBreakpoint reuse, dedupe button css)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
// Imported first: loading this before 'spec/helpers/testing-library' or
|
||||
// '@superset-ui/core' ensures mockAntdWithDesktopBreakpoint is defined
|
||||
// before anything transitively requires (and thus mocks) 'antd'.
|
||||
import { mockAntdWithDesktopBreakpoint } from 'spec/helpers/mobileTestUtils';
|
||||
import * as reactRedux from 'react-redux';
|
||||
import fetchMock from 'fetch-mock';
|
||||
import {
|
||||
@@ -51,13 +55,7 @@ jest.mock('react-redux', () => ({
|
||||
}));
|
||||
|
||||
// Mock useBreakpoint to return desktop breakpoints (prevents mobile menu rendering)
|
||||
jest.mock('antd', () => ({
|
||||
...jest.requireActual('antd'),
|
||||
Grid: {
|
||||
...jest.requireActual('antd').Grid,
|
||||
useBreakpoint: () => ({ xs: true, sm: true, md: true, lg: true, xl: true }),
|
||||
},
|
||||
}));
|
||||
jest.mock('antd', () => mockAntdWithDesktopBreakpoint());
|
||||
|
||||
jest.mock('src/features/databases/DatabaseModal', () => {
|
||||
const DatabaseModal = () => <span />;
|
||||
|
||||
@@ -33,6 +33,12 @@ function MobileUnsupported() {
|
||||
const theme = useTheme();
|
||||
const history = useHistory();
|
||||
|
||||
const actionButtonCss = css`
|
||||
width: 280px;
|
||||
height: 48px;
|
||||
font-size: ${theme.fontSizeSM}px;
|
||||
`;
|
||||
|
||||
const handleViewDashboards = useCallback(() => {
|
||||
history.push('/dashboard/list/');
|
||||
}, [history]);
|
||||
@@ -108,11 +114,7 @@ function MobileUnsupported() {
|
||||
<Button
|
||||
buttonStyle="primary"
|
||||
onClick={handleViewDashboards}
|
||||
css={css`
|
||||
width: 280px;
|
||||
height: 48px;
|
||||
font-size: ${theme.fontSizeSM}px;
|
||||
`}
|
||||
css={actionButtonCss}
|
||||
>
|
||||
{t('View Dashboards')}
|
||||
</Button>
|
||||
@@ -127,11 +129,7 @@ function MobileUnsupported() {
|
||||
<Button
|
||||
buttonStyle="secondary"
|
||||
onClick={handleGoHome}
|
||||
css={css`
|
||||
width: 280px;
|
||||
height: 48px;
|
||||
font-size: ${theme.fontSizeSM}px;
|
||||
`}
|
||||
css={actionButtonCss}
|
||||
>
|
||||
{t('Go to Welcome Page')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user