fix(fe): clean up and fix utests
This commit is contained in:
parent
f8fba12446
commit
a2f8b2263c
11 changed files with 88 additions and 88 deletions
|
@ -1,22 +1,22 @@
|
||||||
import { List, Set, Map } from "immutable";
|
import { List, Set, Map } from "immutable";
|
||||||
import { mock, instance } from "ts-mockito";
|
|
||||||
|
|
||||||
|
import { initMockWorker } from "../../test/helpers";
|
||||||
import { User, UploadInfo } from "../../client";
|
import { User, UploadInfo } from "../../client";
|
||||||
import { AuthPane } from "../pane_login";
|
import { AuthPane } from "../pane_login";
|
||||||
import { ICoreState, newState } from "../core_state";
|
import { ICoreState, newState } from "../core_state";
|
||||||
import { initUploadMgr } from "../../worker/upload_mgr";
|
|
||||||
import { updater } from "../state_updater";
|
import { updater } from "../state_updater";
|
||||||
import { MockWorker, UploadState, UploadEntry } from "../../worker/interface";
|
import { UploadState, UploadEntry } from "../../worker/interface";
|
||||||
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
||||||
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
||||||
import { MockSettingsClient } from "../../client/settings_mock";
|
import { MockSettingsClient } from "../../client/settings_mock";
|
||||||
|
import { controlName as panelTabs } from "../root_frame";
|
||||||
|
import { settingsDialogCtrl } from "../layers";
|
||||||
|
import { settingsTabsCtrl } from "../dialog_settings";
|
||||||
|
|
||||||
describe("Login", () => {
|
describe("Login", () => {
|
||||||
test("login", async () => {
|
initMockWorker();
|
||||||
const mockWorkerClass = mock(MockWorker);
|
|
||||||
const mockWorker = instance(mockWorkerClass);
|
|
||||||
initUploadMgr(mockWorker);
|
|
||||||
|
|
||||||
|
test("login", async () => {
|
||||||
const coreState = newState();
|
const coreState = newState();
|
||||||
const pane = new AuthPane({
|
const pane = new AuthPane({
|
||||||
login: coreState.login,
|
login: coreState.login,
|
||||||
|
@ -34,7 +34,7 @@ describe("Login", () => {
|
||||||
|
|
||||||
// TODO: state is not checked
|
// TODO: state is not checked
|
||||||
|
|
||||||
// browser
|
// files, uploadings, sharings
|
||||||
expect(coreState.filesInfo.dirPath.join("/")).toEqual("mock_home/files");
|
expect(coreState.filesInfo.dirPath.join("/")).toEqual("mock_home/files");
|
||||||
expect(coreState.filesInfo.isSharing).toEqual(true);
|
expect(coreState.filesInfo.isSharing).toEqual(true);
|
||||||
expect(coreState.sharingsInfo.sharings).toEqual(
|
expect(coreState.sharingsInfo.sharings).toEqual(
|
||||||
|
@ -98,5 +98,34 @@ describe("Login", () => {
|
||||||
users: usersMap,
|
users: usersMap,
|
||||||
roles: roles,
|
roles: roles,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ui
|
||||||
|
expect(coreState.ui).toEqual({
|
||||||
|
isVertical: false,
|
||||||
|
siteName: "",
|
||||||
|
siteDesc: "",
|
||||||
|
bg: {
|
||||||
|
url: "clientCfg_bg_url",
|
||||||
|
repeat: "clientCfg_bg_repeat",
|
||||||
|
position: "clientCfg_bg_position",
|
||||||
|
align: "clientCfg_bg_align",
|
||||||
|
},
|
||||||
|
control: {
|
||||||
|
controls: Map<string, string>({
|
||||||
|
[panelTabs]: "filesPanel",
|
||||||
|
[settingsDialogCtrl]: "off",
|
||||||
|
[settingsTabsCtrl]: "preferencePane",
|
||||||
|
}),
|
||||||
|
options: Map<string, Set<string>>({
|
||||||
|
[panelTabs]: Set<string>([
|
||||||
|
"filesPanel",
|
||||||
|
"uploadingsPanel",
|
||||||
|
"sharingsPanel",
|
||||||
|
]),
|
||||||
|
[settingsDialogCtrl]: Set<string>(["on", "off"]),
|
||||||
|
[settingsTabsCtrl]: Set<string>(["preferencePane", "managementPane"]),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
import { mock, instance, verify, when, anything } from "ts-mockito";
|
import { mock, instance, verify, when, anything } from "ts-mockito";
|
||||||
import { List } from "immutable";
|
import { List } from "immutable";
|
||||||
|
|
||||||
|
import { initMockWorker } from "../../test/helpers";
|
||||||
import { FilesPanel } from "../panel_files";
|
import { FilesPanel } from "../panel_files";
|
||||||
import { initUploadMgr } from "../../worker/upload_mgr";
|
|
||||||
import { ICoreState, newState } from "../core_state";
|
import { ICoreState, newState } from "../core_state";
|
||||||
import { updater } from "../state_updater";
|
import { updater } from "../state_updater";
|
||||||
import { MockWorker } from "../../worker/interface";
|
|
||||||
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
||||||
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
||||||
import { MockSettingsClient } from "../../client/settings_mock";
|
import { MockSettingsClient } from "../../client/settings_mock";
|
||||||
|
|
||||||
describe("FilesPanel", () => {
|
describe("FilesPanel", () => {
|
||||||
const initFilesPanel = (): any => {
|
const initFilesPanel = (): any => {
|
||||||
const mockWorkerClass = mock(MockWorker);
|
initMockWorker();
|
||||||
const mockWorker = instance(mockWorkerClass);
|
|
||||||
initUploadMgr(mockWorker);
|
|
||||||
|
|
||||||
const coreState = newState();
|
const coreState = newState();
|
||||||
const usersCl = new MockUsersClient("");
|
const usersCl = new MockUsersClient("");
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { mock, instance, verify, when, anything } from "ts-mockito";
|
import { mock, instance } from "ts-mockito";
|
||||||
import { List } from "immutable";
|
|
||||||
|
|
||||||
import { UploadingsPanel } from "../panel_uploadings";
|
import { UploadingsPanel } from "../panel_uploadings";
|
||||||
import { initUploadMgr } from "../../worker/upload_mgr";
|
import { initUploadMgr } from "../../worker/upload_mgr";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { List, Set, Map } from "immutable";
|
import { List, Set, Map } from "immutable";
|
||||||
import { mock, instance } from "ts-mockito";
|
import { mock, instance } from "ts-mockito";
|
||||||
|
|
||||||
|
import { initMockWorker } from "../../test/helpers";
|
||||||
import { StateMgr } from "../state_mgr";
|
import { StateMgr } from "../state_mgr";
|
||||||
import { initUploadMgr } from "../../worker/upload_mgr";
|
|
||||||
import { User, UploadInfo } from "../../client";
|
import { User, UploadInfo } from "../../client";
|
||||||
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
||||||
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
||||||
|
@ -11,19 +11,17 @@ import {
|
||||||
resps as settingsResps,
|
resps as settingsResps,
|
||||||
} from "../../client/settings_mock";
|
} from "../../client/settings_mock";
|
||||||
import { ICoreState, newState } from "../core_state";
|
import { ICoreState, newState } from "../core_state";
|
||||||
import { MockWorker, UploadState, UploadEntry } from "../../worker/interface";
|
import { UploadState, UploadEntry } from "../../worker/interface";
|
||||||
import { MsgPackage } from "../../i18n/msger";
|
import { MsgPackage } from "../../i18n/msger";
|
||||||
|
|
||||||
describe("State Manager", () => {
|
describe("State Manager", () => {
|
||||||
|
initMockWorker();
|
||||||
|
|
||||||
test("initUpdater for admin", async () => {
|
test("initUpdater for admin", async () => {
|
||||||
const usersCl = new MockUsersClient("");
|
const usersCl = new MockUsersClient("");
|
||||||
const filesCl = new MockFilesClient("");
|
const filesCl = new MockFilesClient("");
|
||||||
const settingsCl = new MockSettingsClient("");
|
const settingsCl = new MockSettingsClient("");
|
||||||
|
|
||||||
const mockWorkerClass = mock(MockWorker);
|
|
||||||
const mockWorker = instance(mockWorkerClass);
|
|
||||||
initUploadMgr(mockWorker);
|
|
||||||
|
|
||||||
const mgr = new StateMgr({}); // it will call initUpdater
|
const mgr = new StateMgr({}); // it will call initUpdater
|
||||||
mgr.setUsersClient(usersCl);
|
mgr.setUsersClient(usersCl);
|
||||||
mgr.setFilesClient(filesCl);
|
mgr.setFilesClient(filesCl);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { List, Set, Map } from "immutable";
|
import { List, Set, Map } from "immutable";
|
||||||
import { mock, instance } from "ts-mockito";
|
|
||||||
|
|
||||||
|
import { initMockWorker } from "../../test/helpers";
|
||||||
import { TopBar } from "../topbar";
|
import { TopBar } from "../topbar";
|
||||||
import { initUploadMgr } from "../../worker/upload_mgr";
|
|
||||||
import { ICoreState, newState } from "../core_state";
|
import { ICoreState, newState } from "../core_state";
|
||||||
import { updater } from "../state_updater";
|
import { updater } from "../state_updater";
|
||||||
import { MockWorker } from "../../worker/interface";
|
|
||||||
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
import { MockUsersClient, resps as usersResps } from "../../client/users_mock";
|
||||||
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
import { MockFilesClient, resps as filesResps } from "../../client/files_mock";
|
||||||
import { MockSettingsClient } from "../../client/settings_mock";
|
import { MockSettingsClient } from "../../client/settings_mock";
|
||||||
|
@ -13,17 +11,14 @@ import { MockSettingsClient } from "../../client/settings_mock";
|
||||||
import { UploadInfo, visitorID, roleVisitor, MetadataResp } from "../../client";
|
import { UploadInfo, visitorID, roleVisitor, MetadataResp } from "../../client";
|
||||||
import { UploadEntry, UploadState } from "../../worker/interface";
|
import { UploadEntry, UploadState } from "../../worker/interface";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("TopBar", () => {
|
describe("TopBar", () => {
|
||||||
|
initMockWorker();
|
||||||
// stub confirm
|
// stub confirm
|
||||||
window.confirm = (message?: string): boolean => {return true;};
|
window.confirm = (message?: string): boolean => {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
test("logout as visitor without sharing", async () => {
|
test("logout as visitor without sharing", async () => {
|
||||||
const mockWorkerClass = mock(MockWorker);
|
|
||||||
const mockWorker = instance(mockWorkerClass);
|
|
||||||
initUploadMgr(mockWorker);
|
|
||||||
|
|
||||||
const coreState = newState();
|
const coreState = newState();
|
||||||
|
|
||||||
const isSharingMockResp = { status: 404, statusText: "", data: {} };
|
const isSharingMockResp = { status: 404, statusText: "", data: {} };
|
||||||
|
@ -42,7 +37,7 @@ describe("TopBar", () => {
|
||||||
const listHomeMockResp = {
|
const listHomeMockResp = {
|
||||||
status: 401,
|
status: 401,
|
||||||
statusText: "",
|
statusText: "",
|
||||||
data: { cwd: "", metadatas: new Array<MetadataResp>() }
|
data: { cwd: "", metadatas: new Array<MetadataResp>() },
|
||||||
};
|
};
|
||||||
const mockFileResps = {
|
const mockFileResps = {
|
||||||
...filesResps,
|
...filesResps,
|
||||||
|
@ -50,7 +45,7 @@ describe("TopBar", () => {
|
||||||
isSharingMockResp,
|
isSharingMockResp,
|
||||||
listSharingsMockResp,
|
listSharingsMockResp,
|
||||||
listUploadingsMockResp,
|
listUploadingsMockResp,
|
||||||
}
|
};
|
||||||
|
|
||||||
const selfMockResp = {
|
const selfMockResp = {
|
||||||
status: 401,
|
status: 401,
|
||||||
|
@ -66,7 +61,7 @@ describe("TopBar", () => {
|
||||||
downloadSpeedLimit: 0,
|
downloadSpeedLimit: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
const isAuthedMockResp = { status: 401, statusText: "", data: {} };
|
const isAuthedMockResp = { status: 401, statusText: "", data: {} };
|
||||||
const mockUserResps = {
|
const mockUserResps = {
|
||||||
...usersResps,
|
...usersResps,
|
||||||
|
@ -91,8 +86,10 @@ describe("TopBar", () => {
|
||||||
|
|
||||||
await topbar.logout();
|
await topbar.logout();
|
||||||
|
|
||||||
// browser
|
// files, uploadings, sharings
|
||||||
expect(coreState.filesInfo.dirPath.join("/")).toEqual(mockFileResps.listHomeMockResp.data.cwd);
|
expect(coreState.filesInfo.dirPath.join("/")).toEqual(
|
||||||
|
mockFileResps.listHomeMockResp.data.cwd
|
||||||
|
);
|
||||||
expect(coreState.filesInfo.isSharing).toEqual(false);
|
expect(coreState.filesInfo.isSharing).toEqual(false);
|
||||||
expect(coreState.filesInfo.items).toEqual(List());
|
expect(coreState.filesInfo.items).toEqual(List());
|
||||||
expect(coreState.sharingsInfo.sharings).toEqual(List());
|
expect(coreState.sharingsInfo.sharings).toEqual(List());
|
||||||
|
@ -121,7 +118,7 @@ describe("TopBar", () => {
|
||||||
cssURL: "",
|
cssURL: "",
|
||||||
lanPackURL: "",
|
lanPackURL: "",
|
||||||
lan: "en_US",
|
lan: "en_US",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// admin
|
// admin
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { List, Set, Map } from "immutable";
|
||||||
|
|
||||||
import { UploadEntry } from "../worker/interface";
|
import { UploadEntry } from "../worker/interface";
|
||||||
|
|
||||||
import { loginDialogCtrl, settingsDialogCtrl } from "./layers";
|
import { settingsDialogCtrl } from "./layers";
|
||||||
import { FilesProps } from "./panel_files";
|
import { FilesProps } from "./panel_files";
|
||||||
import { UploadingsProps } from "./panel_uploadings";
|
import { UploadingsProps } from "./panel_uploadings";
|
||||||
import { SharingsProps } from "./panel_sharings";
|
import { SharingsProps } from "./panel_sharings";
|
||||||
|
@ -61,6 +61,10 @@ export function initState(): ICoreState {
|
||||||
sharingsInfo: {
|
sharingsInfo: {
|
||||||
sharings: List<string>([]),
|
sharings: List<string>([]),
|
||||||
},
|
},
|
||||||
|
admin: {
|
||||||
|
users: Map<string, User>(),
|
||||||
|
roles: Set<string>(),
|
||||||
|
},
|
||||||
login: {
|
login: {
|
||||||
userID: "",
|
userID: "",
|
||||||
userName: "",
|
userName: "",
|
||||||
|
@ -85,10 +89,6 @@ export function initState(): ICoreState {
|
||||||
lan: "en_US",
|
lan: "en_US",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
admin: {
|
|
||||||
users: Map<string, User>(),
|
|
||||||
roles: Set<string>(),
|
|
||||||
},
|
|
||||||
msg: {
|
msg: {
|
||||||
lan: "en_US",
|
lan: "en_US",
|
||||||
pkg: MsgPackage.get("en_US"),
|
pkg: MsgPackage.get("en_US"),
|
||||||
|
@ -106,7 +106,6 @@ export function initState(): ICoreState {
|
||||||
control: {
|
control: {
|
||||||
controls: Map<string, string>({
|
controls: Map<string, string>({
|
||||||
[panelTabs]: "filesPanel",
|
[panelTabs]: "filesPanel",
|
||||||
[loginDialogCtrl]: "on",
|
|
||||||
[settingsDialogCtrl]: "off",
|
[settingsDialogCtrl]: "off",
|
||||||
[settingsTabsCtrl]: "preferencePane",
|
[settingsTabsCtrl]: "preferencePane",
|
||||||
}),
|
}),
|
||||||
|
@ -116,7 +115,6 @@ export function initState(): ICoreState {
|
||||||
"uploadingsPanel",
|
"uploadingsPanel",
|
||||||
"sharingsPanel",
|
"sharingsPanel",
|
||||||
]),
|
]),
|
||||||
[loginDialogCtrl]: Set<string>(["on", "off"]),
|
|
||||||
[settingsDialogCtrl]: Set<string>(["on", "off"]),
|
[settingsDialogCtrl]: Set<string>(["on", "off"]),
|
||||||
[settingsTabsCtrl]: Set<string>(["preferencePane", "managementPane"]),
|
[settingsTabsCtrl]: Set<string>(["preferencePane", "managementPane"]),
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { AuthPane, LoginProps } from "./pane_login";
|
||||||
import { Flexbox } from "./layout/flexbox";
|
import { Flexbox } from "./layout/flexbox";
|
||||||
import { Container } from "./layout/container";
|
import { Container } from "./layout/container";
|
||||||
|
|
||||||
export const loginDialogCtrl = "loginDialog";
|
|
||||||
export const settingsDialogCtrl = "settingsDialog";
|
export const settingsDialogCtrl = "settingsDialog";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
||||||
super(p);
|
super(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
makeBgStyle = (): Object => {
|
||||||
let bgStyle = undefined;
|
let bgStyle = undefined;
|
||||||
if (
|
if (
|
||||||
this.props.login.preferences != null &&
|
this.props.login.preferences != null &&
|
||||||
|
@ -48,13 +48,13 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
||||||
bgStyle = {};
|
bgStyle = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const fontSizeClass = "font-m";
|
return bgStyle;
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const bgStyle = this.makeBgStyle();
|
||||||
const theme = "theme-default";
|
const theme = "theme-default";
|
||||||
const showBrowser =
|
const fontSizeClass = "font-m";
|
||||||
this.props.login.userRole === roleVisitor &&
|
|
||||||
!this.props.filesInfo.isSharing
|
|
||||||
? "hidden"
|
|
||||||
: "";
|
|
||||||
|
|
||||||
const displaying = this.props.ui.control.controls.get(controlName);
|
const displaying = this.props.ui.control.controls.get(controlName);
|
||||||
const filesPanelClass = displaying === "filesPanel" ? "" : "hidden";
|
const filesPanelClass = displaying === "filesPanel" ? "" : "hidden";
|
||||||
|
@ -107,7 +107,7 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={`container-center ${showBrowser}`}>
|
<div className="container-center">
|
||||||
<span className={filesPanelClass}>
|
<span className={filesPanelClass}>
|
||||||
<FilesPanel
|
<FilesPanel
|
||||||
filesInfo={this.props.filesInfo}
|
filesInfo={this.props.filesInfo}
|
||||||
|
|
|
@ -303,10 +303,6 @@ export class Updater {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.isSharing(this.props.filesInfo.dirPath.join("/"));
|
return this.isSharing(this.props.filesInfo.dirPath.join("/"));
|
||||||
})
|
})
|
||||||
.then(() => {
|
|
||||||
// init settings
|
|
||||||
return this.getClientCfg();
|
|
||||||
})
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.props.login.userRole !== roleVisitor) {
|
if (this.props.login.userRole !== roleVisitor) {
|
||||||
// init panels for authned users
|
// init panels for authned users
|
||||||
|
@ -317,6 +313,10 @@ export class Updater {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
// init settings
|
||||||
|
return this.getClientCfg();
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// init i18n
|
// init i18n
|
||||||
// TOOD: status is ignored, should return alert
|
// TOOD: status is ignored, should return alert
|
||||||
|
@ -341,6 +341,8 @@ export class Updater {
|
||||||
downloadSpeedLimit: 0,
|
downloadSpeedLimit: 0,
|
||||||
spaceLimit: "0",
|
spaceLimit: "0",
|
||||||
};
|
};
|
||||||
|
this.props.login.authed = false;
|
||||||
|
this.props.login.captchaID = "";
|
||||||
this.props.login.preferences = {
|
this.props.login.preferences = {
|
||||||
bg: {
|
bg: {
|
||||||
url: "",
|
url: "",
|
||||||
|
@ -460,7 +462,6 @@ export class Updater {
|
||||||
|
|
||||||
logout = async (): Promise<boolean> => {
|
logout = async (): Promise<boolean> => {
|
||||||
const resp = await this.usersClient.logout();
|
const resp = await this.usersClient.logout();
|
||||||
updater().setAuthed(false);
|
|
||||||
this.resetUser();
|
this.resetUser();
|
||||||
return resp.status === 200;
|
return resp.status === 200;
|
||||||
};
|
};
|
||||||
|
@ -511,23 +512,6 @@ export class Updater {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setTab = (tabName: string) => {
|
|
||||||
// switch (tabName) {
|
|
||||||
// case "item":
|
|
||||||
// this.props.panels.displaying = tabName;
|
|
||||||
// break;
|
|
||||||
// case "uploading":
|
|
||||||
// this.props.panels.displaying = tabName;
|
|
||||||
// break;
|
|
||||||
// case "sharing":
|
|
||||||
// this.props.panels.displaying = tabName;
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// this.props.panels.displaying = "item";
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
setControlOption = (controlName: string, option: string): boolean => {
|
setControlOption = (controlName: string, option: string): boolean => {
|
||||||
const controlExists = this.props.ui.control.controls.has(controlName);
|
const controlExists = this.props.ui.control.controls.has(controlName);
|
||||||
const optionsExists = this.props.ui.control.options.has(controlName);
|
const optionsExists = this.props.ui.control.options.has(controlName);
|
||||||
|
|
|
@ -82,22 +82,11 @@ export class TopBar extends React.Component<Props, State, {}> {
|
||||||
|
|
||||||
<Flexbox
|
<Flexbox
|
||||||
children={List([
|
children={List([
|
||||||
// <span className={`${showUserInfo}`}>
|
|
||||||
// <span id="topbar-user-info">{this.props.login.userName}</span>
|
|
||||||
// </span>,
|
|
||||||
|
|
||||||
<button onClick={this.showSettings} className={`margin-r-m`}>
|
<button onClick={this.showSettings} className={`margin-r-m`}>
|
||||||
{this.props.msg.pkg.get("settings")}
|
{this.props.msg.pkg.get("settings")}
|
||||||
{/* {getIcon("RiSettings4Line", "1.8rem", "cyan0")} */}
|
{/* {getIcon("RiSettings4Line", "1.8rem", "cyan0")} */}
|
||||||
</button>,
|
</button>,
|
||||||
|
|
||||||
// <button
|
|
||||||
// onClick={this.showAdmin}
|
|
||||||
// className={`margin-r-m ${showAdmin}`}
|
|
||||||
// >
|
|
||||||
// {this.props.msg.pkg.get("admin")}
|
|
||||||
// </button>,
|
|
||||||
|
|
||||||
<button onClick={this.logout} className={`${showLogin}`}>
|
<button onClick={this.logout} className={`${showLogin}`}>
|
||||||
{this.props.msg.pkg.get("login.logout")}
|
{this.props.msg.pkg.get("login.logout")}
|
||||||
</button>,
|
</button>,
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
import { mock, instance } from "ts-mockito";
|
||||||
|
import { List } from "immutable";
|
||||||
|
|
||||||
|
import { MockWorker } from "../worker/interface";
|
||||||
|
import { initUploadMgr } from "../worker/upload_mgr";
|
||||||
import { Response } from "../client";
|
import { Response } from "../client";
|
||||||
import { ICoreState, initState } from "../components/core_state";
|
import { ICoreState, initState } from "../components/core_state";
|
||||||
import { List } from "immutable";
|
|
||||||
|
|
||||||
export const makePromise = (ret: any): Promise<any> => {
|
export const makePromise = (ret: any): Promise<any> => {
|
||||||
return new Promise<any>((resolve) => {
|
return new Promise<any>((resolve) => {
|
||||||
|
@ -38,3 +42,9 @@ export function mockFileList(filePaths: Array<string>): List<File> {
|
||||||
})
|
})
|
||||||
return List<File>(files);
|
return List<File>(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initMockWorker() {
|
||||||
|
const mockWorkerClass = mock(MockWorker);
|
||||||
|
const mockWorker = instance(mockWorkerClass);
|
||||||
|
initUploadMgr(mockWorker);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue