Migrating some files from javascript to typescript (#24663)

* Migrating some files to typescript

* Some other files migrated

* Migrating more javascript to typescript

* Migrating more javascript to typescript

* Fixing types

* Fixing linter errors

* Fixing some imports

* Fixing linter errors

* Renaming the snapshots

* Addressing PR review comments
Этот коммит содержится в:
Jesús Espino
2023-10-10 16:22:11 +02:00
коммит произвёл GitHub
родитель 4ae44810d3
Коммит bb4aa764bc
53 изменённых файлов: 942 добавлений и 381 удалений

Просмотреть файл

@@ -11,8 +11,8 @@ import {getBool} from 'mattermost-redux/selectors/entities/preferences';
import {unregisterAdminConsolePlugin} from 'actions/admin_actions';
import {trackPluginInitialization} from 'actions/telemetry_actions';
import {unregisterPluginTranslationsSource} from 'actions/views/root';
import {unregisterAllPluginWebSocketEvents, unregisterPluginReconnectHandler} from 'actions/websocket_actions.jsx';
import store from 'stores/redux_store.jsx';
import {unregisterAllPluginWebSocketEvents, unregisterPluginReconnectHandler} from 'actions/websocket_actions';
import store from 'stores/redux_store';
import PluginRegistry from 'plugins/registry';
import {ActionTypes} from 'utils/constants';

Просмотреть файл

@@ -1,239 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`plugins/Pluggable should match snapshot with extended component 1`] = `
<Pluggable
components={
Object {
"PopoverSection1": Array [
Object {
"component": [Function],
},
],
}
}
pluggableName="PopoverSection1"
theme={Object {}}
>
<PluggableErrorBoundary
key="PopoverSection1undefined"
>
<ProfilePopoverPlugin
theme={Object {}}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with extended component with pluggableName 1`] = `
<Pluggable
components={
Object {
"PopoverSection1": Array [
Object {
"component": [Function],
},
],
}
}
pluggableName="PopoverSection1"
theme={Object {}}
>
<PluggableErrorBoundary
key="PopoverSection1undefined"
>
<ProfilePopoverPlugin
theme={Object {}}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with no extended component 1`] = `
<Pluggable
components={Object {}}
pluggableName=""
theme={Object {}}
/>
`;
exports[`plugins/Pluggable should match snapshot with non-null pluggableId 1`] = `
<Pluggable
components={
Object {
"PopoverSection1": Array [
Object {
"component": [Function],
},
],
}
}
pluggableId="pluggableId"
pluggableName="PopoverSection1"
/>
`;
exports[`plugins/Pluggable should match snapshot with null pluggableId 1`] = `
<Pluggable
components={
Object {
"PopoverSection1": Array [
Object {
"component": [Function],
},
],
}
}
pluggableName="PopoverSection1"
theme={Object {}}
>
<PluggableErrorBoundary
key="PopoverSection1undefined"
>
<ProfilePopoverPlugin
theme={Object {}}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with valid pluggableId 1`] = `
<Pluggable
components={
Object {
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "pluggableId",
},
],
}
}
pluggableId="pluggableId"
pluggableName="PopoverSection1"
theme={Object {}}
>
<PluggableErrorBoundary
key="PopoverSection1pluggableId"
>
<ProfilePopoverPlugin
theme={Object {}}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;

Просмотреть файл

@@ -0,0 +1,660 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`plugins/Pluggable should match snapshot with extended component 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "",
"pluginId": "",
},
],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableName="PopoverSection1"
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>
<PluggableErrorBoundary
key="PopoverSection1"
pluginId=""
>
<ProfilePopoverPlugin
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with extended component with pluggableName 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "",
"pluginId": "",
},
],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableName="PopoverSection1"
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>
<PluggableErrorBoundary
key="PopoverSection1"
pluginId=""
>
<ProfilePopoverPlugin
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with no extended component 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableName=""
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
/>
`;
exports[`plugins/Pluggable should match snapshot with non-null pluggableId 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "",
"pluginId": "",
},
],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableId="pluggableId"
pluggableName="PopoverSection1"
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
/>
`;
exports[`plugins/Pluggable should match snapshot with null pluggableId 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "",
"pluginId": "",
},
],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableName="PopoverSection1"
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>
<PluggableErrorBoundary
key="PopoverSection1"
pluginId=""
>
<ProfilePopoverPlugin
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;
exports[`plugins/Pluggable should match snapshot with valid pluggableId 1`] = `
<Pluggable
components={
Object {
"AppBar": Array [],
"CallButton": Array [],
"ChannelHeaderButton": Array [],
"CodeBlockAction": Array [],
"CreateBoardFromTemplate": Array [],
"DesktopNotificationHooks": Array [],
"FilePreview": Array [],
"FilesWillUploadHook": Array [],
"LinkTooltip": Array [],
"MainMenu": Array [],
"MobileChannelHeaderButton": Array [],
"NeedsTeamComponent": Array [],
"NewMessagesSeparatorAction": Array [],
"PopoverSection1": Array [
Object {
"component": [Function],
"id": "pluggableId",
"pluginId": "",
},
],
"PostAction": Array [],
"PostDropdownMenu": Array [],
"PostEditorAction": Array [],
"Product": Array [],
"RightHandSidebarComponent": Array [],
"UserGuideDropdownItem": Array [],
}
}
pluggableId="pluggableId"
pluggableName="PopoverSection1"
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>
<PluggableErrorBoundary
key="PopoverSection1pluggableId"
pluginId=""
>
<ProfilePopoverPlugin
theme={
Object {
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
webSocketClient={
WebSocketClient {
"closeCallback": null,
"closeListeners": Set {},
"conn": null,
"connectFailCount": 0,
"connectionId": "",
"connectionUrl": null,
"errorCallback": null,
"errorListeners": Set {},
"eventCallback": null,
"firstConnectCallback": null,
"firstConnectListeners": Set {},
"messageListeners": Set {},
"missedEventCallback": null,
"missedMessageListeners": Set {},
"reconnectCallback": null,
"reconnectListeners": Set {},
"responseCallbacks": Object {},
"responseSequence": 1,
"serverSequence": 0,
}
}
>
<span
id="pluginId"
>
ProfilePopoverPlugin
</span>
</ProfilePopoverPlugin>
</PluggableErrorBoundary>
</Pluggable>
`;

Просмотреть файл

@@ -3,6 +3,8 @@
import React from 'react';
import {Preferences} from 'mattermost-redux/constants';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import Pluggable from './pluggable';
@@ -18,8 +20,28 @@ jest.mock('actions/views/profile_popover');
describe('plugins/Pluggable', () => {
const baseProps = {
pluggableName: '',
components: {},
theme: {},
components: {
Product: [],
CallButton: [],
PostDropdownMenu: [],
PostAction: [],
PostEditorAction: [],
CodeBlockAction: [],
NewMessagesSeparatorAction: [],
FilePreview: [],
MainMenu: [],
LinkTooltip: [],
RightHandSidebarComponent: [],
ChannelHeaderButton: [],
MobileChannelHeaderButton: [],
AppBar: [],
UserGuideDropdownItem: [],
FilesWillUploadHook: [],
NeedsTeamComponent: [],
CreateBoardFromTemplate: [],
DesktopNotificationHooks: [],
},
theme: Preferences.THEMES.denim,
};
test('should match snapshot with no extended component', () => {
@@ -37,7 +59,7 @@ describe('plugins/Pluggable', () => {
<Pluggable
{...baseProps}
pluggableName='PopoverSection1'
components={{PopoverSection1: [{component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: '', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);
@@ -51,7 +73,7 @@ describe('plugins/Pluggable', () => {
<Pluggable
{...baseProps}
pluggableName='PopoverSection1'
components={{PopoverSection1: [{component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: '', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);
@@ -64,7 +86,7 @@ describe('plugins/Pluggable', () => {
const wrapper = mountWithIntl(
<Pluggable
{...baseProps}
components={{PopoverSection1: [{component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: '', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);
@@ -85,9 +107,10 @@ describe('plugins/Pluggable', () => {
test('should match snapshot with non-null pluggableId', () => {
const wrapper = mountWithIntl(
<Pluggable
{...baseProps}
pluggableName='PopoverSection1'
pluggableId={'pluggableId'}
components={{PopoverSection1: [{component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: '', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);
@@ -100,7 +123,7 @@ describe('plugins/Pluggable', () => {
<Pluggable
{...baseProps}
pluggableName='PopoverSection1'
components={{PopoverSection1: [{component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: '', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);
@@ -114,7 +137,7 @@ describe('plugins/Pluggable', () => {
{...baseProps}
pluggableName='PopoverSection1'
pluggableId={'pluggableId'}
components={{PopoverSection1: [{id: 'pluggableId', component: ProfilePopoverPlugin}]}}
components={{...baseProps.components, PopoverSection1: [{id: 'pluggableId', pluginId: '', component: ProfilePopoverPlugin}]}}
/>,
);

Просмотреть файл

@@ -28,7 +28,7 @@ import {
registerPluginReconnectHandler,
unregisterPluginReconnectHandler,
} from 'actions/websocket_actions.jsx';
import store from 'stores/redux_store.jsx';
import store from 'stores/redux_store';
import {ActionTypes} from 'utils/constants';
import {reArg} from 'utils/func';

Просмотреть файл

@@ -37,7 +37,32 @@ exports[`plugins/PostMessageView should match snapshot with extended post type 1
}
theme={
Object {
"id": "theme_id",
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>
@@ -52,7 +77,32 @@ exports[`plugins/PostMessageView should match snapshot with extended post type 1
}
theme={
Object {
"id": "theme_id",
"awayIndicator": "#ffbc1f",
"buttonBg": "#1c58d9",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3f4350",
"codeTheme": "github",
"dndIndicator": "#d24b4e",
"errorTextColor": "#d24b4e",
"linkColor": "#386fe5",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#1e325c",
"mentionHighlightBg": "#ffd470",
"mentionHighlightLink": "#1b1d22",
"newMessageSeparator": "#cc8f00",
"onlineIndicator": "#3db887",
"sidebarBg": "#1e325c",
"sidebarHeaderBg": "#192a4d",
"sidebarHeaderTextColor": "#ffffff",
"sidebarTeamBarBg": "#14213e",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#5d89ea",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#28427b",
"sidebarUnreadText": "#ffffff",
"type": "Denim",
}
}
>

Просмотреть файл

@@ -3,6 +3,8 @@
import React from 'react';
import type {UserProfile} from '@mattermost/types/users';
import MainMenu from 'components/main_menu/main_menu';
import {shallowWithIntl} from 'tests/helpers/intl-test-helper';
@@ -15,7 +17,7 @@ describe('plugins/MainMenuActions', () => {
teamType: '',
teamDisplayName: 'some name',
teamName: 'somename',
currentUser: {id: 'someuserid', roles: 'system_user'},
currentUser: {id: 'someuserid', roles: 'system_user'} as UserProfile,
enableCommands: true,
enableCustomEmoji: true,
enableIncomingWebhooks: true,
@@ -27,7 +29,7 @@ describe('plugins/MainMenuActions', () => {
enablePluginMarketplace: true,
showDropdown: true,
onToggleDropdown: () => {}, //eslint-disable-line no-empty-function
pluginMenuItems: [{id: 'someplugin', text: 'some plugin text', action: pluginAction}],
pluginMenuItems: [{id: 'someplugin', pluginId: 'test', text: 'some plugin text', action: pluginAction}],
canCreateOrDeleteCustomEmoji: true,
canManageIntegrations: true,
moreTeamsToJoin: true,
@@ -54,6 +56,7 @@ describe('plugins/MainMenuActions', () => {
isFreeTrial: false,
teamsLimitReached: false,
usageDeltaTeams: -1,
mobile: false,
};
test('should match snapshot in web view', () => {

Просмотреть файл

@@ -4,6 +4,8 @@
import {shallow, mount} from 'enzyme';
import React from 'react';
import {Preferences} from 'mattermost-redux/constants';
import PostMessageView from 'components/post_view/post_message_view/post_message_view';
class PostTypePlugin extends React.PureComponent {
@@ -13,7 +15,7 @@ class PostTypePlugin extends React.PureComponent {
}
describe('plugins/PostMessageView', () => {
const post = {type: 'testtype', message: 'this is some text', id: 'post_id'};
const post = {type: 'testtype', message: 'this is some text', id: 'post_id'} as any;
const pluginPostTypes = {
testtype: {component: PostTypePlugin},
};
@@ -24,7 +26,7 @@ describe('plugins/PostMessageView', () => {
currentUser: {username: 'username'},
team: {name: 'team_name'},
emojis: {name: 'smile'},
theme: {id: 'theme_id'},
theme: Preferences.THEMES.denim,
enableFormatting: true,
currentRelativeTeamUrl: 'team_url',
};