Merge pull request #7575 from mattermost/MM-54199-attachment-author-name-missing-on-mobile
MM-54199 - attachment author name missing on mobile
This commit is contained in:
commit
2e3d497402
3 changed files with 179 additions and 1 deletions
|
|
@ -0,0 +1,135 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`AttachmentAuthor it matches snapshot when both name and icon are provided 1`] = `
|
||||
<View
|
||||
style={
|
||||
{
|
||||
"flex": 1,
|
||||
"flexDirection": "row",
|
||||
}
|
||||
}
|
||||
>
|
||||
<View
|
||||
style={
|
||||
[
|
||||
{
|
||||
"overflow": "hidden",
|
||||
},
|
||||
{
|
||||
"height": 12,
|
||||
"marginRight": 3,
|
||||
"width": 12,
|
||||
},
|
||||
]
|
||||
}
|
||||
>
|
||||
<FastImageView
|
||||
defaultSource={null}
|
||||
resizeMode="cover"
|
||||
source={
|
||||
{
|
||||
"uri": "https://images.com/image.png",
|
||||
}
|
||||
}
|
||||
style={
|
||||
{
|
||||
"bottom": 0,
|
||||
"left": 0,
|
||||
"position": "absolute",
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
<Text
|
||||
onPress={[Function]}
|
||||
style={
|
||||
[
|
||||
{
|
||||
"color": "rgba(63,67,80,0.5)",
|
||||
"fontSize": 11,
|
||||
},
|
||||
{
|
||||
"color": "rgba(28,88,217,0.5)",
|
||||
},
|
||||
]
|
||||
}
|
||||
>
|
||||
jhondoe
|
||||
</Text>
|
||||
</View>
|
||||
`;
|
||||
|
||||
exports[`AttachmentAuthor it matches snapshot when only icon is provided 1`] = `
|
||||
<View
|
||||
style={
|
||||
{
|
||||
"flex": 1,
|
||||
"flexDirection": "row",
|
||||
}
|
||||
}
|
||||
>
|
||||
<View
|
||||
style={
|
||||
[
|
||||
{
|
||||
"overflow": "hidden",
|
||||
},
|
||||
{
|
||||
"height": 12,
|
||||
"marginRight": 3,
|
||||
"width": 12,
|
||||
},
|
||||
]
|
||||
}
|
||||
>
|
||||
<FastImageView
|
||||
defaultSource={null}
|
||||
resizeMode="cover"
|
||||
source={
|
||||
{
|
||||
"uri": "https://images.com/image.png",
|
||||
}
|
||||
}
|
||||
style={
|
||||
{
|
||||
"bottom": 0,
|
||||
"left": 0,
|
||||
"position": "absolute",
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
`;
|
||||
|
||||
exports[`AttachmentAuthor it matches snapshot when only name is provided 1`] = `
|
||||
<View
|
||||
style={
|
||||
{
|
||||
"flex": 1,
|
||||
"flexDirection": "row",
|
||||
}
|
||||
}
|
||||
>
|
||||
<Text
|
||||
onPress={[Function]}
|
||||
style={
|
||||
[
|
||||
{
|
||||
"color": "rgba(63,67,80,0.5)",
|
||||
"fontSize": 11,
|
||||
},
|
||||
{
|
||||
"color": "rgba(28,88,217,0.5)",
|
||||
},
|
||||
]
|
||||
}
|
||||
>
|
||||
jhondoe
|
||||
</Text>
|
||||
</View>
|
||||
`;
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import Preferences from '@constants/preferences';
|
||||
import {renderWithIntl} from '@test/intl-test-helper';
|
||||
|
||||
import AttachmentAuthor from './attachment_author';
|
||||
|
||||
describe('AttachmentAuthor', () => {
|
||||
const baseProps = {
|
||||
link: 'http://linktoatachment.com',
|
||||
name: 'jhondoe',
|
||||
icon: 'https://images.com/image.png',
|
||||
theme: Preferences.THEMES.denim,
|
||||
};
|
||||
|
||||
test('it matches snapshot when both name and icon are provided', () => {
|
||||
const wrapper = renderWithIntl(<AttachmentAuthor {...baseProps}/>);
|
||||
expect(wrapper.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('it matches snapshot when only name is provided', () => {
|
||||
const props = {
|
||||
...baseProps,
|
||||
icon: undefined,
|
||||
};
|
||||
|
||||
const wrapper = renderWithIntl(<AttachmentAuthor {...props}/>);
|
||||
expect(wrapper.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('it matches snapshot when only icon is provided', () => {
|
||||
const props = {
|
||||
...baseProps,
|
||||
name: undefined,
|
||||
};
|
||||
|
||||
const wrapper = renderWithIntl(<AttachmentAuthor {...props}/>);
|
||||
expect(wrapper.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
@ -80,7 +80,7 @@ export default function MessageAttachment({attachment, channelId, layoutWidth, l
|
|||
value={attachment.pretext}
|
||||
/>
|
||||
<View style={[style.container, style.border, borderStyle]}>
|
||||
{Boolean(attachment.author_icon && attachment.author_name) &&
|
||||
{Boolean(attachment.author_icon || attachment.author_name) &&
|
||||
<AttachmentAuthor
|
||||
icon={attachment.author_icon}
|
||||
link={attachment.author_link}
|
||||
|
|
|
|||
Loading…
Reference in a new issue