Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 1 addition & 5 deletions web/src/components/core/FormValidationError.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2023] SUSE LLC
* Copyright (c) [2023-2026] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -25,10 +25,6 @@ import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { FormValidationError } from "~/components/core";

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

it("renders nothing when message is null", () => {
const { container } = installerRender(<FormValidationError message={null} />);
expect(container).toBeEmptyDOMElement();
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/core/LoginPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ let mockLoginError;

const mockLoginFn = jest.fn();

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("~/components/layout/Header", () => () => <div>Header Mock</div>);

jest.mock("~/context/auth", () => ({
Expand Down
34 changes: 2 additions & 32 deletions web/src/components/core/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2023-2025] SUSE LLC
* Copyright (c) [2023-2026] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -22,9 +22,8 @@

import React from "react";
import { screen, within } from "@testing-library/react";
import { installerRender, mockNavigateFn, mockRoutes, plainRender } from "~/test-utils";
import { installerRender, mockNavigateFn, plainRender } from "~/test-utils";
import useTrackQueriesRefetch from "~/hooks/use-track-queries-refetch";
import { PRODUCT, ROOT } from "~/routes/paths";
import { _ } from "~/i18n";
import Page from "./Page";

Expand All @@ -36,13 +35,6 @@ jest.mock("~/hooks/use-track-queries-refetch", () => ({
default: jest.fn(),
}));

jest.mock("~/components/questions/Questions", () => () => <div>Questions Mock</div>);
jest.mock("~/components/layout/Header", () => () => <div>Header Mock</div>);

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlertMock</div>
));

jest.mock("~/components/core/ProgressBackdrop", () => () => <div>ProgressBackdropMock</div>);

const mockUseTrackQueriesRefetch = jest.mocked(useTrackQueriesRefetch);
Expand Down Expand Up @@ -130,28 +122,6 @@ describe("Page", () => {
const content = screen.getByText("The Content");
expect(content.classList.contains("pf-m-fill")).toBe(true);
});

it("mounts a ProductRegistrationAlert", () => {
installerRender(<Page.Content />);
screen.getByText("ProductRegistrationAlertMock");
});

describe.each([
["login", ROOT.login],
["product selection", PRODUCT.changeProduct],
["product selection progress", PRODUCT.progress],
["installation progress", ROOT.installationProgress],
["installation finished", ROOT.installationFinished],
])(`but at %s path`, (_, path) => {
beforeEach(() => {
mockRoutes(path);
});

it("does not mount ProductRegistrationAlert", () => {
installerRender(<Page.Content />);
expect(screen.queryByText("ProductRegistrationAlertMock")).toBeNull();
});
});
});

describe("Page.Cancel", () => {
Expand Down
8 changes: 1 addition & 7 deletions web/src/components/core/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import React, { Suspense, useId } from "react";
import { Outlet, useLocation, useNavigate } from "react-router";
import { Outlet, useNavigate } from "react-router";
import Link, { LinkProps } from "~/components/core/Link";
import {
Button,
Expand All @@ -48,13 +48,11 @@ import {
import flexStyles from "@patternfly/react-styles/css/utilities/Flex/flex";
import textStyles from "@patternfly/react-styles/css/utilities/Text/text";
import { isEmpty, isObject } from "radashi";
import { SIDE_PATHS } from "~/routes/paths";
import { _, TranslatedString } from "~/i18n";
import type { ProgressBackdropProps } from "~/components/core/ProgressBackdrop";
import ProgressBackdrop from "~/components/core/ProgressBackdrop";
import Header from "~/components/layout/Header";
import Loading from "~/components/layout/Loading";
import { ProductRegistrationAlert } from "~/components/product";
import { Questions } from "../questions";

import type { BreadcrumbProps } from "~/components/core/Breadcrumbs";
Expand Down Expand Up @@ -295,12 +293,8 @@ const Submit = ({ children, ...props }: SubmitActionProps) => {
* @see [Patternfly Page/PageSection](https://www.patternfly.org/components/page#pagesection)
*/
const Content = ({ children, ...pageSectionProps }: PageSectionProps) => {
const location = useLocation();
const mountRegistrationAlert = !SIDE_PATHS.includes(location.pathname);

return (
<PageSection hasBodyWrapper={false} isFilled component="div" {...pageSectionProps}>
{mountRegistrationAlert && <ProductRegistrationAlert />}
{children}
</PageSection>
);
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/l10n/KeyboardSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const keymaps: Keymap[] = [
{ id: "es", description: "Spanish" },
];

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("react-router", () => ({
...jest.requireActual("react-router"),
useNavigate: () => mockNavigateFn,
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/l10n/L10nPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ const timezones: Timezone[] = [
{ id: "Europe/Madrid", parts: ["Europe", "Madrid"], country: "Spain", utcOffset: 120 },
];

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("~/components/core/InstallerOptions", () => () => <div>InstallerOptions Mock</div>);

jest.mock("~/hooks/model/system/l10n", () => ({
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/l10n/LocaleSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const locales: Locale[] = [
{ id: "es_ES.UTF-8", language: "Spanish", territory: "Spain" },
];

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("react-router", () => ({
...jest.requireActual("react-router"),
useNavigate: () => mockNavigateFn,
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/l10n/TimezoneSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ const timezones: Timezone[] = [
},
];

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("react-router", () => ({
...jest.requireActual("react-router"),
useNavigate: () => mockNavigateFn,
Expand Down
6 changes: 1 addition & 5 deletions web/src/components/network/BindingSettingsForm.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2025] SUSE LLC
* Copyright (c) [2025-2026] SUSE LLC
*
* All Rights Reserved.
*
Expand Down Expand Up @@ -55,10 +55,6 @@ let mockConnection: Connection = new Connection("Network 1", {

const mockMutation = jest.fn(() => Promise.resolve());

jest.mock("~/components/product/ProductRegistrationAlert", () => () => (
<div>ProductRegistrationAlert Mock</div>
));

jest.mock("~/hooks/model/system/network", () => ({
...jest.requireActual("~/hooks/model/system/network"),
useDevices: () => [mockDevice],
Expand Down
7 changes: 1 addition & 6 deletions web/src/components/network/NetworkPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2023-2024] SUSE LLC
* Copyright (c) [2023-2026] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -25,11 +25,6 @@ import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import NetworkPage from "~/components/network/NetworkPage";

jest.mock(
"~/components/product/ProductRegistrationAlert",
() => () => -(<div>ProductRegistrationAlert Mock</div>),
);

jest.mock("~/components/network/WifiNetworksList", () => () => <div>WifiNetworksList Mock</div>);

jest.mock("~/components/network/WiredConnectionsList", () => () => (
Expand Down
7 changes: 1 addition & 6 deletions web/src/components/network/WiredConnectionPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2025] SUSE LLC
* Copyright (c) [2025-2026] SUSE LLC
*
* All Rights Reserved.
*
Expand Down Expand Up @@ -30,11 +30,6 @@ const mockConnection: Connection = new Connection("Network 1", {
state: ConnectionState.activated,
});

jest.mock(
"~/components/product/ProductRegistrationAlert",
() => () => -(<div>ProductRegistrationAlert Mock</div>),
);

jest.mock("~/components/network/WiredConnectionDetails", () => () => (
<div>WiredConnectionDetails Mock</div>
));
Expand Down
147 changes: 0 additions & 147 deletions web/src/components/product/ProductRegistrationAlert.test.tsx

This file was deleted.

Loading
Loading