Skip to content

Commit b983b98

Browse files
committed
Fix spacepaneltest & snapshots
1 parent cb17305 commit b983b98

3 files changed

Lines changed: 40 additions & 37 deletions

File tree

apps/web/test/unit-tests/components/views/settings/tabs/user/__snapshots__/SidebarUserSettingsTab-test.tsx.snap

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
5151
class="_container_153f2_10"
5252
>
5353
<input
54-
aria-describedby="test-id-1"
54+
aria-describedby="_r_1_"
5555
checked=""
5656
class="_input_153f2_18"
5757
disabled=""
@@ -99,7 +99,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
9999
</label>
100100
<span
101101
class="_message_19upo_85 _help-message_19upo_91"
102-
id="test-id-1"
102+
id="_r_1_"
103103
>
104104
Home is useful for getting an overview of everything.
105105
</span>
@@ -119,7 +119,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
119119
class="_container_153f2_10"
120120
>
121121
<input
122-
aria-describedby="test-id-5"
122+
aria-describedby="_r_5_"
123123
class="_input_153f2_18"
124124
data-testid="mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"
125125
id="checkbox_38QgU2Pomx"
@@ -154,7 +154,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
154154
</label>
155155
<span
156156
class="_message_19upo_85 _help-message_19upo_91"
157-
id="test-id-5"
157+
id="_r_5_"
158158
>
159159
Show all your rooms in Home, even if they're in a space.
160160
</span>
@@ -174,7 +174,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
174174
class="_container_153f2_10"
175175
>
176176
<input
177-
aria-describedby="test-id-9"
177+
aria-describedby="_r_9_"
178178
class="_input_153f2_18"
179179
id="checkbox_wKpa6hpi3Y"
180180
type="checkbox"
@@ -208,7 +208,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
208208
</label>
209209
<span
210210
class="_message_19upo_85 _help-message_19upo_91"
211-
id="test-id-9"
211+
id="_r_9_"
212212
>
213213
Group all your rooms that aren't part of a space in one place.
214214
</span>
@@ -228,7 +228,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
228228
class="_container_153f2_10"
229229
>
230230
<input
231-
aria-describedby="test-id-13"
231+
aria-describedby="_r_d_"
232232
class="_input_153f2_18"
233233
id="checkbox_EetmBG4yVC"
234234
type="checkbox"
@@ -274,7 +274,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings with guest spa url
274274
</label>
275275
<span
276276
class="_message_19upo_85 _help-message_19upo_91"
277-
id="test-id-13"
277+
id="_r_d_"
278278
>
279279
Group all private video rooms and conferences. In conferences you can invite people outside of matrix.
280280
</span>
@@ -341,7 +341,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
341341
class="_container_153f2_10"
342342
>
343343
<input
344-
aria-describedby="test-id-1"
344+
aria-describedby="_r_h_"
345345
checked=""
346346
class="_input_153f2_18"
347347
disabled=""
@@ -389,7 +389,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
389389
</label>
390390
<span
391391
class="_message_19upo_85 _help-message_19upo_91"
392-
id="test-id-1"
392+
id="_r_h_"
393393
>
394394
Home is useful for getting an overview of everything.
395395
</span>
@@ -409,7 +409,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
409409
class="_container_153f2_10"
410410
>
411411
<input
412-
aria-describedby="test-id-5"
412+
aria-describedby="_r_l_"
413413
class="_input_153f2_18"
414414
data-testid="mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"
415415
id="checkbox_38QgU2Pomx"
@@ -444,7 +444,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
444444
</label>
445445
<span
446446
class="_message_19upo_85 _help-message_19upo_91"
447-
id="test-id-5"
447+
id="_r_l_"
448448
>
449449
Show all your rooms in Home, even if they're in a space.
450450
</span>
@@ -464,7 +464,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
464464
class="_container_153f2_10"
465465
>
466466
<input
467-
aria-describedby="test-id-9"
467+
aria-describedby="_r_p_"
468468
class="_input_153f2_18"
469469
id="checkbox_wKpa6hpi3Y"
470470
type="checkbox"
@@ -498,7 +498,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
498498
</label>
499499
<span
500500
class="_message_19upo_85 _help-message_19upo_91"
501-
id="test-id-9"
501+
id="_r_p_"
502502
>
503503
Group all your rooms that aren't part of a space in one place.
504504
</span>
@@ -518,7 +518,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
518518
class="_container_153f2_10"
519519
>
520520
<input
521-
aria-describedby="test-id-13"
521+
aria-describedby="_r_t_"
522522
class="_input_153f2_18"
523523
id="checkbox_EetmBG4yVC"
524524
type="checkbox"
@@ -564,7 +564,7 @@ exports[`<SidebarUserSettingsTab /> renders sidebar settings without guest spa u
564564
</label>
565565
<span
566566
class="_message_19upo_85 _help-message_19upo_91"
567-
id="test-id-13"
567+
id="_r_t_"
568568
>
569569
Group all private video rooms and conferences.
570570
</span>

apps/web/test/unit-tests/components/views/spaces/SpacePanel-test.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,30 @@ jest.mock("../../../../../src/customisations/helpers/UIComponents", () => ({
107107
}));
108108

109109
describe("<SpacePanel />", () => {
110-
const mockClient = {
111-
getUserId: jest.fn().mockReturnValue("@test:test"),
112-
getSafeUserId: jest.fn().mockReturnValue("@test:test"),
113-
mxcUrlToHttp: jest.fn(),
114-
getRoom: jest.fn(),
115-
isGuest: jest.fn(),
116-
getAccountData: jest.fn(),
117-
on: jest.fn(),
118-
off: jest.fn(),
119-
removeListener: jest.fn(),
120-
isVersionSupported: jest.fn().mockResolvedValue(true),
121-
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
122-
} as unknown as MatrixClient;
123-
const SpacePanel = wrapInSdkContext(wrapInMatrixClientContext(UnwrappedSpacePanel), SdkContextClass.instance);
124-
125-
beforeAll(() => {
110+
let mockClient: MatrixClient;
111+
112+
let SpacePanel: React.ComponentType = () => null;
113+
114+
beforeEach(() => {
115+
mockClient = {
116+
getUserId: jest.fn().mockReturnValue("@test:test"),
117+
getSafeUserId: jest.fn().mockReturnValue("@test:test"),
118+
mxcUrlToHttp: jest.fn(),
119+
getRoom: jest.fn(),
120+
isGuest: jest.fn(),
121+
getAccountData: jest.fn(),
122+
on: jest.fn(),
123+
off: jest.fn(),
124+
removeListener: jest.fn(),
125+
isVersionSupported: jest.fn().mockResolvedValue(true),
126+
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
127+
} as unknown as MatrixClient;
128+
126129
jest.spyOn(MatrixClientPeg, "get").mockReturnValue(mockClient);
127130
jest.spyOn(MatrixClientPeg, "safeGet").mockReturnValue(mockClient);
128-
});
129131

130-
beforeEach(() => {
132+
SpacePanel = wrapInSdkContext(wrapInMatrixClientContext(UnwrappedSpacePanel), SdkContextClass.instance);
133+
131134
SpaceStore.instance.enabledMetaSpaces.push(
132135
MetaSpace.Home,
133136
MetaSpace.Favourites,

apps/web/test/unit-tests/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ exports[`<SpacePanel /> should show all activated MetaSpaces in the correct orde
332332
aria-expanded="false"
333333
aria-haspopup="menu"
334334
aria-label="Threads"
335-
aria-labelledby="test-id-34"
335+
aria-labelledby="test-id-16"
336336
class="_icon-button_1215g_8 mx_ThreadsActivityCentreButton"
337337
data-kind="primary"
338338
data-state="closed"
339-
id="radix-test-id-32"
339+
id="radix-_r_g_"
340340
role="button"
341341
style="--cpd-icon-button-size: 32px;"
342342
tabindex="0"
@@ -364,7 +364,7 @@ exports[`<SpacePanel /> should show all activated MetaSpaces in the correct orde
364364
<button
365365
aria-expanded="false"
366366
aria-label="Quick settings"
367-
aria-labelledby="test-id-39"
367+
aria-labelledby="test-id-18"
368368
class="_icon-button_1215g_8 mx_QuickSettingsButton"
369369
data-kind="primary"
370370
role="button"

0 commit comments

Comments
 (0)