Don't show empty privacy section (#32582)
* Don't show empty privacy section If all the options to display things things in it are disabled Also makes it more consistent with other areas. * Move test
This commit is contained in:
@@ -15,8 +15,6 @@ import userEvent from "@testing-library/user-event";
|
||||
import { DiscoverySettings } from "../../../../../../src/components/views/settings/discovery/DiscoverySettings";
|
||||
import { stubClient } from "../../../../../test-utils";
|
||||
import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext";
|
||||
import { UIFeature } from "../../../../../../src/settings/UIFeature";
|
||||
import SettingsStore from "../../../../../../src/settings/SettingsStore";
|
||||
import defaultDispatcher from "../../../../../../src/dispatcher/dispatcher";
|
||||
|
||||
const mockGetAccessToken = jest.fn().mockResolvedValue("$$getAccessToken");
|
||||
@@ -51,16 +49,6 @@ describe("DiscoverySettings", () => {
|
||||
|
||||
const DiscoveryWrapper = (props = {}) => <MatrixClientContext.Provider value={client} {...props} />;
|
||||
|
||||
it("is empty if 3pid features are disabled", async () => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((key: any): any => {
|
||||
if (key === UIFeature.ThirdPartyID) return false;
|
||||
});
|
||||
|
||||
const { container } = render(<DiscoverySettings />, { wrapper: DiscoveryWrapper });
|
||||
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it("displays alert if an identity server needs terms accepting", async () => {
|
||||
mocked(client).getIdentityServerUrl.mockReturnValue("https://example.com");
|
||||
mocked(client).getTerms.mockResolvedValue(sampleTerms);
|
||||
|
||||
+13
-1
@@ -5,7 +5,7 @@ Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
import { render } from "jest-matrix-react";
|
||||
import { render, screen } from "jest-matrix-react";
|
||||
import React, { act } from "react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
|
||||
@@ -21,6 +21,8 @@ import {
|
||||
} from "../../../../../../test-utils";
|
||||
import { SDKContext, SdkContextClass } from "../../../../../../../src/contexts/SDKContext";
|
||||
import defaultDispatcher from "../../../../../../../src/dispatcher/dispatcher";
|
||||
import { UIFeature } from "../../../../../../../src/settings/UIFeature";
|
||||
import SettingsStore from "../../../../../../../src/settings/SettingsStore";
|
||||
|
||||
describe("<SecurityUserSettingsTab />", () => {
|
||||
const defaultProps = {
|
||||
@@ -89,4 +91,14 @@ describe("<SecurityUserSettingsTab />", () => {
|
||||
});
|
||||
expect(getByText("You have no ignored users.")).toBeVisible();
|
||||
});
|
||||
|
||||
it("does not render privacy header if 3pid features are disabled", async () => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((key: any): any => {
|
||||
if (key === UIFeature.ThirdPartyID) return false;
|
||||
});
|
||||
|
||||
render(getComponent());
|
||||
|
||||
expect(screen.queryByRole("heading", { name: "Privacy" })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user