Skip to content

Commit

Permalink
MM-16906 - Updating class for size aware images (mattermost#3086)
Browse files Browse the repository at this point in the history
* MM-16906 - Updating class for size aware images

* Updating test
  • Loading branch information
asaadmahmood authored and sudheerDev committed Jul 10, 2019
1 parent fac3456 commit 88c26c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/size_aware_image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export default class SizeAwareImage extends React.PureComponent {
className='style--none'
>
<img
className={this.props.className}
alt='image placeholder'
src={src}
onError={this.handleError}
Expand Down
7 changes: 7 additions & 0 deletions components/size_aware_image.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ describe('components/SizeAwareImage', () => {
expect(style).toHaveProperty('visibility', 'hidden');
});

test('img should have inherited class name from prop', () => {
const wrapper = mount(<SizeAwareImage {...{...baseProps, className: 'imgClass'}}/>);

const className = wrapper.find('img').prop('className');
expect(className).toEqual('imgClass');
});

test('should render a placeholder and has loader when showLoader is true', () => {
const props = {
...baseProps,
Expand Down

0 comments on commit 88c26c2

Please sign in to comment.