[web] Add tests for js/components/ContentView/UploadContentButton.jsx

This commit is contained in:
Matthew Shao 2017-06-06 19:04:40 +08:00
parent c9a7286b60
commit 3d51595b27
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import React from 'react'
import renderer from 'react-test-renderer'
import UploadContentButton from '../../../components/ContentView/UploadContentButton'
describe('UpdateContentButton Component', () => {
it('should render correctly', () => {
let uploadContentFn = jest.fn(),
uploadContentButton = renderer.create(<UploadContentButton uploadContent={uploadContentFn}/>),
tree = uploadContentButton.toJSON()
expect(tree).toMatchSnapshot()
})
})

View File

@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UpdateContentButton Component should render correctly 1`] = `
<a
className="btn btn-default btn-xs"
href="#"
onClick={[Function]}
title="Upload a file to replace the content."
>
<i
className="fa fa-fw fa-upload"
/>
<input
className="hidden"
onChange={[Function]}
type="file"
/>
</a>
`;

View File

@ -1,3 +1,4 @@
import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import FileChooser from '../common/FileChooser' import FileChooser from '../common/FileChooser'