MM-47110 : Migrate "components/advanced_create_comment/advanced_create_comment.test.jsx" to Typescript (#24257)
Этот коммит содержится в:
@@ -14,15 +14,62 @@ exports[`components/AdvancedCreateComment should match snapshot when cannot post
|
|||||||
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
||||||
draft={
|
draft={
|
||||||
Object {
|
Object {
|
||||||
|
"channelId": "",
|
||||||
|
"createAt": 0,
|
||||||
"fileInfos": Array [
|
"fileInfos": Array [
|
||||||
Object {},
|
Object {
|
||||||
Object {},
|
"archived": false,
|
||||||
Object {},
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"message": "Test message",
|
"message": "Test message",
|
||||||
"uploadsInProgress": Array [
|
"rootId": "",
|
||||||
Object {},
|
"updateAt": 0,
|
||||||
],
|
"uploadsInProgress": Array [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emitTypingEvent={[Function]}
|
emitTypingEvent={[Function]}
|
||||||
@@ -87,8 +134,12 @@ exports[`components/AdvancedCreateComment should match snapshot, comment with me
|
|||||||
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
||||||
draft={
|
draft={
|
||||||
Object {
|
Object {
|
||||||
|
"channelId": "",
|
||||||
|
"createAt": 0,
|
||||||
"fileInfos": Array [],
|
"fileInfos": Array [],
|
||||||
"message": "Test message",
|
"message": "Test message",
|
||||||
|
"rootId": "",
|
||||||
|
"updateAt": 0,
|
||||||
"uploadsInProgress": Array [],
|
"uploadsInProgress": Array [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,15 +206,62 @@ exports[`components/AdvancedCreateComment should match snapshot, emoji picker di
|
|||||||
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
||||||
draft={
|
draft={
|
||||||
Object {
|
Object {
|
||||||
|
"channelId": "",
|
||||||
|
"createAt": 0,
|
||||||
"fileInfos": Array [
|
"fileInfos": Array [
|
||||||
Object {},
|
Object {
|
||||||
Object {},
|
"archived": false,
|
||||||
Object {},
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"message": "Test message",
|
"message": "Test message",
|
||||||
"uploadsInProgress": Array [
|
"rootId": "",
|
||||||
Object {},
|
"updateAt": 0,
|
||||||
],
|
"uploadsInProgress": Array [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emitTypingEvent={[Function]}
|
emitTypingEvent={[Function]}
|
||||||
@@ -228,8 +326,12 @@ exports[`components/AdvancedCreateComment should match snapshot, empty comment 1
|
|||||||
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
||||||
draft={
|
draft={
|
||||||
Object {
|
Object {
|
||||||
|
"channelId": "",
|
||||||
|
"createAt": 0,
|
||||||
"fileInfos": Array [],
|
"fileInfos": Array [],
|
||||||
"message": "",
|
"message": "",
|
||||||
|
"rootId": "",
|
||||||
|
"updateAt": 0,
|
||||||
"uploadsInProgress": Array [],
|
"uploadsInProgress": Array [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,15 +398,62 @@ exports[`components/AdvancedCreateComment should match snapshot, non-empty messa
|
|||||||
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
currentUserId="zaktnt8bpbgu8mb6ez9k64r7sa"
|
||||||
draft={
|
draft={
|
||||||
Object {
|
Object {
|
||||||
|
"channelId": "",
|
||||||
|
"createAt": 0,
|
||||||
"fileInfos": Array [
|
"fileInfos": Array [
|
||||||
Object {},
|
Object {
|
||||||
Object {},
|
"archived": false,
|
||||||
Object {},
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"archived": false,
|
||||||
|
"clientId": "client_id",
|
||||||
|
"create_at": 1,
|
||||||
|
"delete_at": 1,
|
||||||
|
"extension": "jpg",
|
||||||
|
"has_preview_image": true,
|
||||||
|
"height": 200,
|
||||||
|
"id": "file_info_id",
|
||||||
|
"mime_type": "mime_type",
|
||||||
|
"name": "name",
|
||||||
|
"size": 1,
|
||||||
|
"update_at": 1,
|
||||||
|
"user_id": "user_id",
|
||||||
|
"width": 350,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"message": "Test message",
|
"message": "Test message",
|
||||||
"uploadsInProgress": Array [
|
"rootId": "",
|
||||||
Object {},
|
"updateAt": 0,
|
||||||
],
|
"uploadsInProgress": Array [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emitTypingEvent={[Function]}
|
emitTypingEvent={[Function]}
|
||||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -60,7 +60,7 @@ import FileLimitStickyBanner from 'components/file_limit_sticky_banner';
|
|||||||
|
|
||||||
const KeyCodes = Constants.KeyCodes;
|
const KeyCodes = Constants.KeyCodes;
|
||||||
|
|
||||||
type Props = {
|
export type Props = {
|
||||||
currentTeamId: string;
|
currentTeamId: string;
|
||||||
|
|
||||||
// The channel for which this comment is a part of
|
// The channel for which this comment is a part of
|
||||||
@@ -219,10 +219,13 @@ function isDraftEmpty(draft: PostDraft): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AdvancedCreateComment extends React.PureComponent<Props, State> {
|
class AdvancedCreateComment extends React.PureComponent<Props, State> {
|
||||||
private lastBlurAt = 0;
|
// public because accessed in advanced_create_comment.test.tsx
|
||||||
private draftsForPost: {[postID: string]: PostDraft | null} = {};
|
public draftsForPost: {[postID: string]: PostDraft | null} = {};
|
||||||
private doInitialScrollToBottom = false;
|
public doInitialScrollToBottom = false;
|
||||||
|
|
||||||
|
private readonly textboxRef: React.RefObject<TextboxClass>;
|
||||||
|
|
||||||
|
private lastBlurAt = 0;
|
||||||
private saveDraftFrame?: number | null;
|
private saveDraftFrame?: number | null;
|
||||||
|
|
||||||
private isDraftSubmitting = false;
|
private isDraftSubmitting = false;
|
||||||
@@ -230,7 +233,6 @@ class AdvancedCreateComment extends React.PureComponent<Props, State> {
|
|||||||
private isNonFormattedPaste = false;
|
private isNonFormattedPaste = false;
|
||||||
private timeoutId: number | null = null;
|
private timeoutId: number | null = null;
|
||||||
|
|
||||||
private readonly textboxRef: React.RefObject<TextboxClass>;
|
|
||||||
private readonly fileUploadRef: React.RefObject<FileUploadClass>;
|
private readonly fileUploadRef: React.RefObject<FileUploadClass>;
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
|||||||
1
webapp/channels/src/types/global.d.ts
поставляемый
1
webapp/channels/src/types/global.d.ts
поставляемый
@@ -2,3 +2,4 @@
|
|||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
declare const COMMIT_HASH: string;
|
declare const COMMIT_HASH: string;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,21 @@ import {PreferenceType} from '@mattermost/types/preferences';
|
|||||||
import {Reaction} from '@mattermost/types/reactions';
|
import {Reaction} from '@mattermost/types/reactions';
|
||||||
import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils';
|
import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils';
|
||||||
import {Invoice, Product, Subscription, CloudCustomer} from '@mattermost/types/cloud';
|
import {Invoice, Product, Subscription, CloudCustomer} from '@mattermost/types/cloud';
|
||||||
|
import {PostDraft} from 'types/store/draft';
|
||||||
|
|
||||||
export class TestHelper {
|
export class TestHelper {
|
||||||
|
public static getPostDraftMock(override?: Partial<PostDraft>): PostDraft {
|
||||||
|
const defaultPostDraft: PostDraft = {
|
||||||
|
message: 'Test message',
|
||||||
|
fileInfos: [],
|
||||||
|
uploadsInProgress: [],
|
||||||
|
channelId: '',
|
||||||
|
rootId: '',
|
||||||
|
createAt: 0,
|
||||||
|
updateAt: 0,
|
||||||
|
};
|
||||||
|
return Object.assign({}, defaultPostDraft, override);
|
||||||
|
}
|
||||||
public static getUserMock(override: Partial<UserProfile> = {}): UserProfile {
|
public static getUserMock(override: Partial<UserProfile> = {}): UserProfile {
|
||||||
const defaultUser: UserProfile = {
|
const defaultUser: UserProfile = {
|
||||||
id: 'user_id',
|
id: 'user_id',
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user