diff options
author | Matthew Shao <me@matshao.com> | 2017-06-06 19:04:40 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-06-06 19:04:40 +0800 |
commit | 3d51595b27c6e24a377166a2dc793c0f271ed612 (patch) | |
tree | e6d52476c8e0e7a949c2067ec4463d81f8f3d0da | |
parent | c9a7286b6009d8a1b98babd3292685e1a9163019 (diff) | |
download | mitmproxy-3d51595b27c6e24a377166a2dc793c0f271ed612.tar.gz mitmproxy-3d51595b27c6e24a377166a2dc793c0f271ed612.tar.bz2 mitmproxy-3d51595b27c6e24a377166a2dc793c0f271ed612.zip |
[web] Add tests for js/components/ContentView/UploadContentButton.jsx
3 files changed, 32 insertions, 0 deletions
diff --git a/web/src/js/__tests__/components/ContentView/UploadContentButtonSpec.js b/web/src/js/__tests__/components/ContentView/UploadContentButtonSpec.js new file mode 100644 index 00000000..3695be72 --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/UploadContentButtonSpec.js @@ -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() + }) +}) diff --git a/web/src/js/__tests__/components/ContentView/__snapshots__/UploadContentButtonSpec.js.snap b/web/src/js/__tests__/components/ContentView/__snapshots__/UploadContentButtonSpec.js.snap new file mode 100644 index 00000000..f642d731 --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/__snapshots__/UploadContentButtonSpec.js.snap @@ -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> +`; diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx index 0021593f..847d4eb0 100644 --- a/web/src/js/components/ContentView/UploadContentButton.jsx +++ b/web/src/js/components/ContentView/UploadContentButton.jsx @@ -1,3 +1,4 @@ +import React from 'react' import PropTypes from 'prop-types' import FileChooser from '../common/FileChooser' |