MM-50953 Post textbox cleanup (#23971)
* Remove unused code around scrollbarWidth * MM-50953 Remove unused code for popover at mentions * Add tests for messageHtmlToComponent wrapper
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c4949a664d
Коммит
1f95a8f52b
@@ -45,7 +45,22 @@ window.Luxon = require('luxon');
|
||||
window.StyledComponents = require('styled-components');
|
||||
|
||||
// Functions exposed on window for plugins to use.
|
||||
window.PostUtils = {formatText, messageHtmlToComponent};
|
||||
window.PostUtils = {
|
||||
formatText,
|
||||
messageHtmlToComponent: (html, ...otherArgs) => {
|
||||
// Previously, this function took an extra isRHS argument as the second parameter. For backwards compatibility,
|
||||
// support calling this as either messageHtmlToComponent(html, options) or messageHtmlToComponent(html, isRhs, options)
|
||||
|
||||
let options;
|
||||
if (otherArgs.length === 2) {
|
||||
options = otherArgs[1];
|
||||
} else if (otherArgs.length === 1 && typeof otherArgs[0] === 'object') {
|
||||
options = otherArgs[0];
|
||||
}
|
||||
|
||||
return messageHtmlToComponent(html, options);
|
||||
},
|
||||
};
|
||||
window.openInteractiveDialog = openInteractiveDialog;
|
||||
window.useNotifyAdmin = useNotifyAdmin;
|
||||
window.WebappUtils = {
|
||||
|
||||
38
webapp/channels/src/plugins/export.test.js
Обычный файл
38
webapp/channels/src/plugins/export.test.js
Обычный файл
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import messageHtmlToComponent from 'utils/message_html_to_component';
|
||||
|
||||
import './export';
|
||||
|
||||
jest.mock('utils/message_html_to_component');
|
||||
|
||||
describe('messageHtmlToComponent wrapper', () => {
|
||||
const message = 'test';
|
||||
const options = {emoji: true, images: false};
|
||||
const isRHS = false;
|
||||
|
||||
test('should call messageHtmlToComponent properly with only message', () => {
|
||||
window.PostUtils.messageHtmlToComponent(message);
|
||||
|
||||
expect(messageHtmlToComponent).toHaveBeenCalledWith(message, undefined);
|
||||
});
|
||||
|
||||
test('should call messageHtmlToComponent properly with message and options', () => {
|
||||
window.PostUtils.messageHtmlToComponent(message, options);
|
||||
|
||||
expect(messageHtmlToComponent).toHaveBeenCalledWith(message, options);
|
||||
});
|
||||
|
||||
test('should call messageHtmlToComponent properly with only message when deprecated isRHS parameter is passed', () => {
|
||||
window.PostUtils.messageHtmlToComponent(message, isRHS);
|
||||
|
||||
expect(messageHtmlToComponent).toHaveBeenCalledWith(message, undefined);
|
||||
});
|
||||
|
||||
test('should call messageHtmlToComponent properly with message and options when deprecated isRHS parameter is passed', () => {
|
||||
window.PostUtils.messageHtmlToComponent(message, isRHS, options);
|
||||
|
||||
expect(messageHtmlToComponent).toHaveBeenCalledWith(message, options);
|
||||
});
|
||||
});
|
||||
@@ -84,7 +84,6 @@ exports[`plugins/PostMessageView should match snapshot with no extended post typ
|
||||
"onImageLoaded": [Function],
|
||||
}
|
||||
}
|
||||
isRHS={false}
|
||||
mentionKeys={Array []}
|
||||
message="this is some text"
|
||||
options={Object {}}
|
||||
|
||||
Ссылка в новой задаче
Block a user