## Description This is an internal cleanup change, which removes the collaboration pointers from the Editor. **_Background_**: We had a feature for collaboration which we had sunset. As a part of this feature, we could see the mouse pointers of the other users who were editing the same page in realtime. This feature is today visible only to internal Appsmith users. This part of the feature, also doesn't serve a purpose for our users. **_Why are we removing this?:_** This code has no impact on our users. This makes maintaining this code, as well as the additional computational load on the components unnecessary. **_How do we put this back in?:_** The idea of this PR is to see the changes in one place and hence make it easy to revert when needed. Fixes #19659 19659 Media Here is what it looked like:  Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import React, { ReactElement } from "react";
|
|
import { render, RenderOptions, queries } from "@testing-library/react";
|
|
import { Provider } from "react-redux";
|
|
import { ThemeProvider } from "styled-components";
|
|
import { getCurrentThemeDetails } from "selectors/themeSelectors";
|
|
import * as customQueries from "./customQueries";
|
|
import { BrowserRouter } from "react-router-dom";
|
|
import appReducer, { AppState } from "@appsmith/reducers";
|
|
import { applyMiddleware, compose, createStore } from "redux";
|
|
import { reduxBatch } from "@manaflair/redux-batch";
|
|
import createSagaMiddleware from "redux-saga";
|
|
import store, { testStore } from "store";
|
|
import { sagasToRunForTests } from "./sagas";
|
|
import { all, call, spawn } from "redux-saga/effects";
|
|
import RouteChangeListener from "RouteChangeListener";
|
|
|
|
const testSagaMiddleware = createSagaMiddleware();
|
|
|
|
const testStoreWithTestMiddleWare = (initialState: Partial<AppState>) =>
|
|
createStore(
|
|
appReducer,
|
|
initialState,
|
|
compose(reduxBatch, applyMiddleware(testSagaMiddleware), reduxBatch),
|
|
);
|
|
|
|
const rootSaga = function*(sagasToRun = sagasToRunForTests) {
|
|
yield all(
|
|
sagasToRun.map((saga) =>
|
|
spawn(function*() {
|
|
while (true) {
|
|
yield call(saga);
|
|
break;
|
|
}
|
|
}),
|
|
),
|
|
);
|
|
};
|
|
|
|
const customRender = (
|
|
ui: ReactElement,
|
|
state?: {
|
|
url?: string;
|
|
initialState?: Partial<AppState>;
|
|
sagasToRun?: typeof sagasToRunForTests;
|
|
},
|
|
options?: Omit<RenderOptions, "queries">,
|
|
) => {
|
|
let reduxStore = store;
|
|
window.history.pushState({}, "Appsmith", state?.url || "/");
|
|
if (state && state.initialState) {
|
|
reduxStore = testStore(state.initialState || {});
|
|
}
|
|
if (state && state.sagasToRun) {
|
|
reduxStore = testStoreWithTestMiddleWare(reduxStore.getState());
|
|
testSagaMiddleware.run(() => rootSaga(state.sagasToRun));
|
|
}
|
|
const defaultTheme = getCurrentThemeDetails(reduxStore.getState());
|
|
return render(
|
|
<BrowserRouter>
|
|
<Provider store={reduxStore}>
|
|
<RouteChangeListener />
|
|
<ThemeProvider theme={defaultTheme}>{ui}</ThemeProvider>
|
|
</Provider>
|
|
</BrowserRouter>,
|
|
{
|
|
queries: { ...queries, ...customQueries },
|
|
...options,
|
|
},
|
|
);
|
|
};
|
|
|
|
export * from "@testing-library/react";
|
|
|
|
export { customRender as render };
|