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:
rusackas
2026-07-27 03:37:35 -07:00
parent fcfe3553a3
commit d1116d9c2b
2 changed files with 13 additions and 17 deletions

View File

@@ -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 />;

View File

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