delint and remove groups-specific tests and setups
This commit is contained in:
parent
cbd6f2de44
commit
da110855f0
6 changed files with 3 additions and 100 deletions
|
@ -25,7 +25,6 @@ import AccessibleButton from '../views/elements/AccessibleButton';
|
|||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||
import { replaceableComponent } from "../../utils/replaceableComponent";
|
||||
import BetaCard from "../views/beta/BetaCard";
|
||||
|
||||
@replaceableComponent("structures.MyGroups")
|
||||
export default class MyGroups extends React.Component {
|
||||
|
|
|
@ -16,9 +16,9 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||
import React, { ReactNode } from "react";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { _t, _td } from '../languageHandler';
|
||||
import { _td } from '../languageHandler';
|
||||
import {
|
||||
NotificationBodyEnabledController,
|
||||
NotificationsEnabledController,
|
||||
|
@ -40,7 +40,6 @@ import { OrderedMultiController } from "./controllers/OrderedMultiController";
|
|||
import { Layout } from "./Layout";
|
||||
import ReducedMotionController from './controllers/ReducedMotionController';
|
||||
import IncompatibleController from "./controllers/IncompatibleController";
|
||||
import SdkConfig from "../SdkConfig";
|
||||
import PseudonymousAnalyticsController from './controllers/PseudonymousAnalyticsController';
|
||||
import NewLayoutSwitcherController from './controllers/NewLayoutSwitcherController';
|
||||
|
||||
|
|
|
@ -20,12 +20,6 @@ function generateRoomId() {
|
|||
return '!' + Math.random().toString().slice(2, 10) + ':domain';
|
||||
}
|
||||
|
||||
function waitForRoomListStoreUpdate() {
|
||||
return new Promise((resolve) => {
|
||||
RoomListStore.instance.once(LISTS_UPDATE_EVENT, () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
describe('RoomList', () => {
|
||||
function createRoom(opts) {
|
||||
const room = new Room(generateRoomId(), MatrixClientPeg.get(), client.getUserId(), {
|
||||
|
@ -239,73 +233,6 @@ describe('RoomList', () => {
|
|||
});
|
||||
}
|
||||
|
||||
describe('when no tags are selected', () => {
|
||||
itDoesCorrectOptimisticUpdatesForDraggedRoomTiles();
|
||||
});
|
||||
|
||||
describe('when tags are selected', () => {
|
||||
function setupSelectedTag() {
|
||||
// Simulate a complete sync BEFORE dispatching anything else
|
||||
dis.dispatch({
|
||||
action: 'MatrixActions.sync',
|
||||
prevState: null,
|
||||
state: 'PREPARED',
|
||||
matrixClient: client,
|
||||
}, true);
|
||||
|
||||
// Simulate joined groups being received
|
||||
dis.dispatch({
|
||||
action: 'GroupActions.fetchJoinedGroups.success',
|
||||
result: {
|
||||
groups: ['+group:domain'],
|
||||
},
|
||||
}, true);
|
||||
|
||||
// Simulate receiving tag ordering account data
|
||||
dis.dispatch({
|
||||
action: 'MatrixActions.accountData',
|
||||
event_type: 'im.vector.web.tag_ordering',
|
||||
event_content: {
|
||||
tags: ['+group:domain'],
|
||||
},
|
||||
}, true);
|
||||
|
||||
// GroupStore is not flux, mock and notify
|
||||
GroupStore.getGroupRooms = (groupId) => {
|
||||
return [movingRoom];
|
||||
};
|
||||
GroupStore._notifyListeners();
|
||||
|
||||
// We also have to mock the client's getGroup function for the room list to filter it.
|
||||
// It's not smart enough to tell the difference between a real group and a template though.
|
||||
client.getGroup = (groupId) => {
|
||||
return { groupId };
|
||||
};
|
||||
|
||||
// Select tag
|
||||
dis.dispatch({ action: 'select_tag', tag: '+group:domain' }, true);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
setupSelectedTag();
|
||||
});
|
||||
|
||||
it('displays the correct rooms when the groups rooms are changed', async () => {
|
||||
GroupStore.getGroupRooms = (groupId) => {
|
||||
return [movingRoom, otherRoom];
|
||||
};
|
||||
GroupStore._notifyListeners();
|
||||
|
||||
await waitForRoomListStoreUpdate();
|
||||
|
||||
// XXX: Even though the store updated, it can take a bit before the update makes
|
||||
// it to the components. This gives it plenty of time to figure out what to do.
|
||||
await (new Promise(resolve => setTimeout(resolve, 500)));
|
||||
|
||||
expectRoomInSubList(otherRoom, (s) => s.props.tagId === DefaultTagID.Untagged);
|
||||
});
|
||||
|
||||
itDoesCorrectOptimisticUpdatesForDraggedRoomTiles();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
|
||||
// This needs to be executed before the SpaceStore gets imported but due to ES6 import hoisting we have to do this here.
|
||||
// SpaceStore reads the SettingsStore which needs the localStorage values set at init time.
|
||||
|
||||
localStorage.setItem("mx_labs_feature_feature_spaces", "true");
|
|
@ -18,7 +18,6 @@ import { EventEmitter } from "events";
|
|||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
|
||||
import "./SpaceStore-setup"; // enable space lab
|
||||
import "../skinned-sdk"; // Must be first for skinning to work
|
||||
import SpaceStore, {
|
||||
UPDATE_HOME_BEHAVIOUR,
|
||||
|
|
|
@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import "../SpaceStore-setup"; // enable space lab
|
||||
import "../../skinned-sdk"; // Must be first for skinning to work
|
||||
import { SpaceWatcher } from "../../../src/stores/room-list/SpaceWatcher";
|
||||
import type { RoomListStoreClass } from "../../../src/stores/room-list/RoomListStore";
|
||||
|
|
Loading…
Reference in a new issue