rusackas commented on code in PR #37141: URL: https://github.com/apache/superset/pull/37141#discussion_r3718427289
########## superset-frontend/src/pages/Home/Home.mobile.test.tsx: ########## @@ -0,0 +1,179 @@ +/** + * 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. + */ + +/** + * Mobile-specific tests for the Home/Welcome page. + * + * These tests verify that certain desktop-only sections are hidden + * on mobile viewports. + */ + +import fetchMock from 'fetch-mock'; +import { render, screen, waitFor } from 'spec/helpers/testing-library'; +import Welcome from 'src/pages/Home'; + +import { mockMobileMatchMedia } from 'spec/helpers/mobileTestUtils'; + +// Enable only the mobile consumption mode flag so the mobile branch renders +jest.mock('@superset-ui/core', () => ({ + ...jest.requireActual('@superset-ui/core'), + isFeatureEnabled: jest.fn( + (flag: string) => flag === 'MOBILE_CONSUMPTION_MODE', + ), +})); + +// Simulate a mobile viewport for the useIsMobile hook +mockMobileMatchMedia(); Review Comment: Fixed — captured the cleanup function and restore it in `afterAll`. ########## superset-frontend/src/pages/DashboardList/index.tsx: ########## @@ -177,6 +179,9 @@ const DASHBOARD_COLUMNS_TO_FETCH = [ function DashboardList(props: DashboardListProps) { const { addDangerToast, addSuccessToast, user } = props; + const isNotMobile = !useIsMobile(); Review Comment: Fixed — renamed to `isMobile` and flipped the three usages. -- 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]
