From 0c32dc1c72ee043016e31d3c0e329acc04ab37ab Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 13 Dec 2021 12:05:31 +0100 Subject: [PATCH 1/7] use fieldset in space settings > visibility Signed-off-by: Kerry Archibald --- .../spaces/SpaceSettingsVisibilityTab.tsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx index 0ee9b48b76a..48909281dee 100644 --- a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx +++ b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx @@ -28,6 +28,7 @@ import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import { useLocalEcho } from "../../../hooks/useLocalEcho"; import JoinRuleSettings from "../settings/JoinRuleSettings"; import { useRoomState } from "../../../hooks/useRoomState"; +import SettingsFieldset from "../settings/SettingsFieldset"; interface IProps { matrixClient: MatrixClient; @@ -113,21 +114,24 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn { error &&
{ error }
} -
-
- { _t("Decide who can view and join %(spaceName)s.", { spaceName: space.name }) } -
- -
- setError(_t("Failed to update the visibility of this space"))} - closeSettingsFn={closeSettingsFn} - /> -
- + + setError(_t("Failed to update the visibility of this space"))} + closeSettingsFn={closeSettingsFn} + /> { advancedSection } - + + +

{ _t("Allow people to preview your space before they join.") }

+

{ _t("Recommended for public spaces.") }

+ } + > { @@ -136,9 +140,7 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn disabled={!canSetHistoryVisibility} label={_t("Preview Space")} /> -
{ _t("Allow people to preview your space before they join.") }
- { _t("Recommended for public spaces.") } -
+ { addressesSection } ; From 4f688d227e541b9f55aa583dded743e0daf5cef8 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 13 Dec 2021 16:36:43 +0100 Subject: [PATCH 2/7] add basic tests for space setttings visibility Signed-off-by: Kerry Archibald --- .../views/room_settings/AliasSettings.tsx | 5 +- .../spaces/SpaceSettingsVisibilityTab.tsx | 15 +- .../SpaceSettingsVisibilityTab-test.tsx | 234 ++++++++++++++++++ .../SpaceSettingsVisibilityTab-test.tsx.snap | 135 ++++++++++ test/test-utils.js | 6 + 5 files changed, 391 insertions(+), 4 deletions(-) create mode 100644 test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx create mode 100644 test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap diff --git a/src/components/views/room_settings/AliasSettings.tsx b/src/components/views/room_settings/AliasSettings.tsx index f2de4d58ec2..a3b97db3330 100644 --- a/src/components/views/room_settings/AliasSettings.tsx +++ b/src/components/views/room_settings/AliasSettings.tsx @@ -381,6 +381,7 @@ export default class AliasSettings extends React.Component { return (
{ isSpaceRoom @@ -426,7 +427,9 @@ export default class AliasSettings extends React.Component { placeholder={_t('New published address (e.g. #alias:server)')} /> - - + { _t("Hide advanced") } @@ -88,7 +92,11 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn ; } else { advancedSection = <> - + { _t("Show advanced") } ; @@ -112,9 +120,10 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn return
{ _t("Visibility") }
- { error &&
{ error }
} + { error &&
{ error }
} diff --git a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx new file mode 100644 index 00000000000..446f50f1d0a --- /dev/null +++ b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx @@ -0,0 +1,234 @@ +// skinned-sdk should be the first import in most tests +import '../../../skinned-sdk'; +import React from "react"; +import { + renderIntoDocument, + Simulate, +} from 'react-dom/test-utils'; +import { act } from "react-dom/test-utils"; +import { EventType, MatrixClient, Room } from 'matrix-js-sdk'; +import { GuestAccess, HistoryVisibility, JoinRule } from 'matrix-js-sdk/src/@types/partials'; + +import SpaceSettingsVisibilityTab from "../../../../src/components/views/spaces/SpaceSettingsVisibilityTab"; +import { createTestClient, mkEvent } from '../../../test-utils'; +import { mkSpace, mockStateEventImplementation } from '../../../utils/test-utils'; +import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; + +jest.useFakeTimers(); + +describe('', () => { + const mockMatrixClient = createTestClient() as MatrixClient; + + const makeJoinEvent = (rule: JoinRule = JoinRule.Invite) => mkEvent({ + type: EventType.RoomJoinRules, event: true, content: { + join_rule: rule, + }, + } as any); + const makeGuestAccessEvent = (rule: GuestAccess = GuestAccess.CanJoin) => mkEvent({ + type: EventType.RoomGuestAccess, event: true, content: { + guest_access: rule, + }, + } as any); + const makeHistoryEvent = (rule: HistoryVisibility = HistoryVisibility.Shared) => mkEvent({ + type: EventType.RoomHistoryVisibility, event: true, content: { + history_visibility: rule, + }, + } as any); + + const mockSpaceId = 'mock-space'; + + // TODO case for canonical + const makeMockSpace = ( + client: MatrixClient, + joinRule: JoinRule = JoinRule.Invite, + guestRule: GuestAccess = GuestAccess.CanJoin, + historyRule: HistoryVisibility = HistoryVisibility.WorldReadable, + ): Room => { + const events = [ + makeJoinEvent(joinRule), + makeGuestAccessEvent(guestRule), + makeHistoryEvent(historyRule), + ]; + const space = mkSpace(client, mockSpaceId); + const getStateEvents = mockStateEventImplementation(events); + space.currentState.getStateEvents.mockImplementation(getStateEvents); + space.currentState.mayClientSendStateEvent.mockReturnValue(false); + const mockGetJoinRule = jest.fn().mockReturnValue(joinRule); + space.getJoinRule = mockGetJoinRule; + space.currentState.getJoinRule = mockGetJoinRule; + return space as unknown as Room; + }; + const defaultProps = { + matrixClient: mockMatrixClient, + space: makeMockSpace(mockMatrixClient), + closeSettingsFn: jest.fn(), + }; + + const getComponent = (props = {}) => { + const wrapper = renderIntoDocument( + // wrap in element so renderIntoDocument can render functional component + + + , + ) as HTMLSpanElement; + return wrapper.children[0]; + }; + + const getByTestId = (container: Element, id: string) => container.querySelector(`[data-test-id=${id}]`); + const toggleGuestAccessSection = async (component) => { + const toggleButton = getByTestId(component, 'toggle-guest-access-btn'); + await act(async () => { + Simulate.click(toggleButton); + }); + }; + const getGuestAccessToggle = component => component.querySelector('[aria-label="Enable guest access"'); + const getHistoryVisibilityToggle = component => component.querySelector('[aria-label="Preview Space"'); + const getErrorMessage = component => getByTestId(component, 'space-settings-error')?.textContent; + + beforeEach(() => { + (mockMatrixClient.sendStateEvent as jest.Mock).mockClear().mockResolvedValue({}); + MatrixClientPeg.get = jest.fn().mockReturnValue(mockMatrixClient); + }); + + afterEach(() => { + jest.runAllTimers(); + }); + + it('renders container', () => { + const component = getComponent(); + expect(component).toMatchSnapshot(); + }); + + describe('for a private space', () => { + const joinRule = JoinRule.Invite; + it('does not render addresses section', () => { + const space = makeMockSpace(mockMatrixClient, joinRule); + const component = getComponent({ space }); + + expect(getByTestId(component, 'published-address-fieldset')).toBeFalsy(); + expect(getByTestId(component, 'local-address-fieldset')).toBeFalsy(); + }); + }); + + describe('for a public space', () => { + const joinRule = JoinRule.Public; + const guestRule = GuestAccess.CanJoin; + const historyRule = HistoryVisibility.Joined; + + describe('Access', () => { + it('renders guest access section toggle', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule); + const component = getComponent({ space }); + + await toggleGuestAccessSection(component); + + expect(getGuestAccessToggle(component)).toMatchSnapshot(); + }); + + it('send guest access event on toggle', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule); + + const component = getComponent({ space }); + await toggleGuestAccessSection(component); + const guestAccessInput = getGuestAccessToggle(component); + + expect(guestAccessInput.getAttribute('aria-checked')).toEqual("true"); + + await act(async () => { + Simulate.click(guestAccessInput); + }); + + expect(mockMatrixClient.sendStateEvent).toHaveBeenCalledWith( + mockSpaceId, + EventType.RoomGuestAccess, + // toggled off + { guest_access: GuestAccess.Forbidden }, + "", + ); + + // toggled off + expect(guestAccessInput.getAttribute('aria-checked')).toEqual("false"); + }); + + it('renders error message when update fails', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule); + (mockMatrixClient.sendStateEvent as jest.Mock).mockRejectedValue({}); + const component = getComponent({ space }); + await toggleGuestAccessSection(component); + await act(async () => { + Simulate.click(getGuestAccessToggle(component)); + }); + + expect(getErrorMessage(component)).toEqual("Failed to update the guest access of this space"); + }); + + it('disables guest access toggle when setting guest access is not allowed', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule); + (space.currentState.maySendStateEvent as jest.Mock).mockReturnValue(false); + const component = getComponent({ space }); + + await toggleGuestAccessSection(component); + + expect(getGuestAccessToggle(component).getAttribute('aria-disabled')).toEqual("true"); + }); + }); + + describe('Preview', () => { + it('renders preview space toggle', () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule, historyRule); + const component = getComponent({ space }); + + // toggle off because space settings is != WorldReadable + expect(getHistoryVisibilityToggle(component).getAttribute('aria-checked')).toEqual("false"); + }); + + it('updates history visibility on toggle', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule, historyRule); + const component = getComponent({ space }); + + // toggle off because space settings is != WorldReadable + expect(getHistoryVisibilityToggle(component).getAttribute('aria-checked')).toEqual("false"); + + await act(async () => { + Simulate.click(getHistoryVisibilityToggle(component)); + }); + + expect(mockMatrixClient.sendStateEvent).toHaveBeenCalledWith( + mockSpaceId, + EventType.RoomHistoryVisibility, + { history_visibility: HistoryVisibility.WorldReadable }, + "", + ); + + expect(getHistoryVisibilityToggle(component).getAttribute('aria-checked')).toEqual("true"); + }); + + it('renders error message when history update fails', async () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule, historyRule); + (mockMatrixClient.sendStateEvent as jest.Mock).mockRejectedValue({}); + const component = getComponent({ space }); + + await act(async () => { + Simulate.click(getHistoryVisibilityToggle(component)); + }); + + expect(getErrorMessage(component)).toEqual("Failed to update the history visibility of this space"); + }); + + it('disables room preview toggle when history visability changes are not allowed', () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule, historyRule); + (space.currentState.maySendStateEvent as jest.Mock).mockReturnValue(false); + const component = getComponent({ space }); + expect(getHistoryVisibilityToggle(component).getAttribute('aria-disabled')).toEqual("true"); + }); + }); + + it('renders addresses section', () => { + const space = makeMockSpace(mockMatrixClient, joinRule, guestRule); + const component = getComponent({ space }); + + expect(getByTestId(component, 'published-address-fieldset')).toBeTruthy(); + expect(getByTestId(component, 'local-address-fieldset')).toBeTruthy(); + }); + }); +}); diff --git a/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap new file mode 100644 index 00000000000..6b56dd8d0a9 --- /dev/null +++ b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap @@ -0,0 +1,135 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` for a public space Access renders guest access section toggle 1`] = ` +
+
+
+`; + +exports[` renders container 1`] = ` +
+
+ Visibility +
+ +
+ + Access + +
+ Decide who can view and join mock-space. +
+
+
+ + Preview Space + +
+

+ Allow people to preview your space before they join. +

+

+ + Recommended for public spaces. + +

+
+
+ + Preview Space + +
+
+
+
+
+
+`; diff --git a/test/test-utils.js b/test/test-utils.js index d34385c7de9..c58b388e3a9 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -1,6 +1,7 @@ import React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; +import { JoinRule } from 'matrix-js-sdk/src/@types/partials'; import { MatrixClientPeg as peg } from '../src/MatrixClientPeg'; import dis from '../src/dispatcher/dispatcher'; @@ -84,6 +85,7 @@ export function createTestClient() { setRoomAccountData: jest.fn(), sendTyping: jest.fn().mockResolvedValue({}), sendMessage: () => jest.fn().mockResolvedValue({}), + sendStateEvent: jest.fn().mockResolvedValue(), getSyncState: () => "SYNCING", generateClientSecret: () => "t35tcl1Ent5ECr3T", isGuest: () => false, @@ -109,6 +111,7 @@ export function createTestClient() { registerWithIdentityServer: jest.fn().mockResolvedValue({}), getIdentityAccount: jest.fn().mockResolvedValue({}), getTerms: jest.fn().mockResolvedValueOnce(), + doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(), }; } @@ -144,6 +147,7 @@ export function mkEvent(opts) { "m.room.name", "m.room.topic", "m.room.create", "m.room.join_rules", "m.room.power_levels", "m.room.topic", "m.room.history_visibility", "m.room.encryption", "m.room.member", "com.example.state", + "m.room.guest_access", ].indexOf(opts.type) !== -1) { event.state_key = ""; } @@ -271,6 +275,8 @@ export function mkStubRoom(roomId = null, name, client) { maySendStateEvent: jest.fn().mockReturnValue(true), maySendEvent: jest.fn().mockReturnValue(true), members: [], + getJoinRule: jest.fn().mockReturnValue(JoinRule.Invite), + on: jest.fn(), }, tags: {}, setBlacklistUnverifiedDevices: jest.fn(), From e2d58b0894ff95a1178d457376cecf9fcaf58e5f Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 13 Dec 2021 16:44:54 +0100 Subject: [PATCH 3/7] i18n Signed-off-by: Kerry Archibald --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 72dd21e9b26..4eb0d1b136e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1123,6 +1123,7 @@ "This may be useful for public spaces.": "This may be useful for public spaces.", "Show advanced": "Show advanced", "Visibility": "Visibility", + "Access": "Access", "Decide who can view and join %(spaceName)s.": "Decide who can view and join %(spaceName)s.", "Failed to update the visibility of this space": "Failed to update the visibility of this space", "Preview Space": "Preview Space", @@ -1556,7 +1557,6 @@ "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. Learn more about encryption.": "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. Learn more about encryption.", "To link to this room, please add an address.": "To link to this room, please add an address.", "Decide who can join %(roomName)s.": "Decide who can join %(roomName)s.", - "Access": "Access", "Failed to update the join rules": "Failed to update the join rules", "Unknown failure": "Unknown failure", "Are you sure you want to make this encrypted room public?": "Are you sure you want to make this encrypted room public?", From 6222e60f77445ebf3a4d887ade1e889398429152 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Tue, 14 Dec 2021 14:14:00 +0100 Subject: [PATCH 4/7] fix toggle button placement Signed-off-by: Kerry Archibald --- .../views/dialogs/_SpaceSettingsDialog.scss | 16 ++--- res/css/views/settings/_ProfileSettings.scss | 1 - res/css/views/settings/tabs/_SettingsTab.scss | 4 ++ .../spaces/SpaceSettingsVisibilityTab.tsx | 65 ++++++++----------- .../SpaceSettingsVisibilityTab-test.tsx.snap | 56 +++++++--------- 5 files changed, 60 insertions(+), 82 deletions(-) diff --git a/res/css/views/dialogs/_SpaceSettingsDialog.scss b/res/css/views/dialogs/_SpaceSettingsDialog.scss index 78fbd573bd2..8f064f6b380 100644 --- a/res/css/views/dialogs/_SpaceSettingsDialog.scss +++ b/res/css/views/dialogs/_SpaceSettingsDialog.scss @@ -38,7 +38,7 @@ limitations under the License. } & + .mx_SettingsTab_subheading { - border-top: 1px solid $quinary-content; + border-top: 1px solid $menu-border-color; margin-top: 0; padding-top: 24px; } @@ -60,15 +60,6 @@ limitations under the License. margin-left: 26px; } } - - .mx_SettingsTab_showAdvanced { - margin: 16px 0; - padding: 0; - } - - .mx_SettingsFlag { - margin-top: 24px; - } } .mx_SpaceSettingsDialog_buttons { @@ -86,6 +77,11 @@ limitations under the License. .mx_AccessibleButton_hasKind { padding: 8px 22px; + + &.mx_SettingsTab_showAdvanced { + margin: 16px 0; + padding: 0; + } } .mx_TabbedView_tabLabel { diff --git a/res/css/views/settings/_ProfileSettings.scss b/res/css/views/settings/_ProfileSettings.scss index ce27b5dd13f..46c89347a86 100644 --- a/res/css/views/settings/_ProfileSettings.scss +++ b/res/css/views/settings/_ProfileSettings.scss @@ -54,7 +54,6 @@ limitations under the License. .mx_ProfileSettings_profileForm { @mixin mx_Settings_fullWidthField; - border-bottom: 1px solid $menu-border-color; } .mx_ProfileSettings_buttons { diff --git a/res/css/views/settings/tabs/_SettingsTab.scss b/res/css/views/settings/tabs/_SettingsTab.scss index 684935152ca..cb0d6b249e1 100644 --- a/res/css/views/settings/tabs/_SettingsTab.scss +++ b/res/css/views/settings/tabs/_SettingsTab.scss @@ -98,3 +98,7 @@ limitations under the License. .mx_SettingsTab a { color: $accent-alt; } + +.mx_SettingsTab_toggleWithDescription { + margin-top: 24px; +} diff --git a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx index 60bf7e3a657..690900c3b72 100644 --- a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx +++ b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx @@ -68,16 +68,16 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn let advancedSection; if (joinRule === JoinRule.Public) { - if (showAdvancedSection) { - advancedSection = <> - - { _t("Hide advanced") } - - + advancedSection =
+ + { showAdvancedSection ? _t("Hide advanced") : _t("Show advanced") } + + + { showAdvancedSection &&
{ _t("This may be useful for public spaces.") }

- ; - } else { - advancedSection = <> - - { _t("Show advanced") } - - ; - } +
+ } +
; } let addressesSection; @@ -133,22 +124,20 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn closeSettingsFn={closeSettingsFn} /> { advancedSection } - - -

{ _t("Allow people to preview your space before they join.") }

-

{ _t("Recommended for public spaces.") }

- } - > - { - setHistoryVisibility(checked ? HistoryVisibility.WorldReadable : HistoryVisibility.Shared); - }} - disabled={!canSetHistoryVisibility} - label={_t("Preview Space")} - /> +
+ { + setHistoryVisibility(checked ? HistoryVisibility.WorldReadable : HistoryVisibility.Shared); + }} + disabled={!canSetHistoryVisibility} + label={_t("Preview Space")} + /> +

+ { _t("Allow people to preview your space before they join.") }
+ { _t("Recommended for public spaces.") } +

+
{ addressesSection } diff --git a/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap index 6b56dd8d0a9..5400f200114 100644 --- a/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap @@ -88,48 +88,38 @@ exports[` renders container 1`] = ` Anyone can find and join. - -
- - Preview Space -
+
+ + Preview Space + +
+
+
+

Allow people to preview your space before they join. -

-

+
Recommended for public spaces.

-
- - Preview Space - -
-
-
-
`; From 4ad2ef9a14afd5970b4f3cd2b848dc41d0a6ca46 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Tue, 14 Dec 2021 14:19:03 +0100 Subject: [PATCH 5/7] i18n Signed-off-by: Kerry Archibald --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4eb0d1b136e..2fd74fcd133 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1118,10 +1118,10 @@ "Failed to update the guest access of this space": "Failed to update the guest access of this space", "Failed to update the history visibility of this space": "Failed to update the history visibility of this space", "Hide advanced": "Hide advanced", + "Show advanced": "Show advanced", "Enable guest access": "Enable guest access", "Guests can join a space without having an account.": "Guests can join a space without having an account.", "This may be useful for public spaces.": "This may be useful for public spaces.", - "Show advanced": "Show advanced", "Visibility": "Visibility", "Access": "Access", "Decide who can view and join %(spaceName)s.": "Decide who can view and join %(spaceName)s.", From ce1234a205d543f7f85b641862bb790b07a31b45 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 6 Jan 2022 10:49:14 +0100 Subject: [PATCH 6/7] update settings separator color to quinary Signed-off-by: Kerry Archibald --- res/css/views/settings/_JoinRuleSettings.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/css/views/settings/_JoinRuleSettings.scss b/res/css/views/settings/_JoinRuleSettings.scss index 76b1b6333af..30d6b6b678c 100644 --- a/res/css/views/settings/_JoinRuleSettings.scss +++ b/res/css/views/settings/_JoinRuleSettings.scss @@ -77,7 +77,7 @@ limitations under the License. color: $secondary-content; & + .mx_StyledRadioButton { - border-top: 1px solid $menu-border-color; + border-top: 1px solid $quinary-content; } } } From 35d195583d2192725f307a2979222390a1b74b34 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 6 Jan 2022 11:02:25 +0100 Subject: [PATCH 7/7] update tests for context dependency Signed-off-by: Kerry Archibald --- .../views/spaces/SpaceSettingsVisibilityTab-test.tsx | 6 ++++-- .../SpaceSettingsVisibilityTab-test.tsx.snap | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx index 446f50f1d0a..d5157ecf7bf 100644 --- a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx +++ b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx @@ -9,11 +9,13 @@ import { act } from "react-dom/test-utils"; import { EventType, MatrixClient, Room } from 'matrix-js-sdk'; import { GuestAccess, HistoryVisibility, JoinRule } from 'matrix-js-sdk/src/@types/partials'; -import SpaceSettingsVisibilityTab from "../../../../src/components/views/spaces/SpaceSettingsVisibilityTab"; -import { createTestClient, mkEvent } from '../../../test-utils'; +import _SpaceSettingsVisibilityTab from "../../../../src/components/views/spaces/SpaceSettingsVisibilityTab"; +import { createTestClient, mkEvent, wrapInMatrixClientContext } from '../../../test-utils'; import { mkSpace, mockStateEventImplementation } from '../../../utils/test-utils'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; +const SpaceSettingsVisibilityTab = wrapInMatrixClientContext(_SpaceSettingsVisibilityTab); + jest.useFakeTimers(); describe('', () => { diff --git a/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap index 5400f200114..ab43705b378 100644 --- a/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap @@ -43,8 +43,10 @@ exports[` renders container 1`] = ` class="mx_StyledRadioButton mx_JoinRuleSettings_radioButton mx_StyledRadioButton_disabled mx_StyledRadioButton_checked" > renders container 1`] = ` class="mx_StyledRadioButton_spacer" /> - + Only invited people can join. - + Anyone can find and join.