mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
[web] Add tests for js/components/ContentView/ContentViewOptions.jsx
This commit is contained in:
parent
de3042911a
commit
ef9ee67c19
@ -0,0 +1,19 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import ContentViewOptions from '../../../components/ContentView/ContentViewOptions'
|
||||
import { Provider } from 'react-redux'
|
||||
import { TFlow, TStore } from '../../ducks/tutils'
|
||||
|
||||
let tflow = new TFlow()
|
||||
|
||||
describe('ContentViewOptions Component', () => {
|
||||
let store = TStore()
|
||||
it('should render correctly', () => {
|
||||
let provider = renderer.create(
|
||||
<Provider store={store}>
|
||||
<ContentViewOptions flow={tflow} message={tflow.response}/>
|
||||
</Provider>),
|
||||
tree = provider.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,41 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ContentViewOptions Component should render correctly 1`] = `
|
||||
<div
|
||||
className="view-options"
|
||||
>
|
||||
<span>
|
||||
<b>
|
||||
View:
|
||||
</b>
|
||||
edit
|
||||
</span>
|
||||
|
||||
<a
|
||||
className="btn btn-default btn-xs"
|
||||
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
|
||||
title="Download the content of the flow."
|
||||
>
|
||||
<i
|
||||
className="fa fa-download"
|
||||
/>
|
||||
</a>
|
||||
|
||||
<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>
|
||||
|
||||
</div>
|
||||
`;
|
@ -4,6 +4,7 @@ import { connect } from 'react-redux'
|
||||
import ViewSelector from './ViewSelector'
|
||||
import UploadContentButton from './UploadContentButton'
|
||||
import DownloadContentButton from './DownloadContentButton'
|
||||
import { uploadContent } from '../../ducks/flows'
|
||||
|
||||
ContentViewOptions.propTypes = {
|
||||
flow: PropTypes.object.isRequired,
|
||||
@ -28,5 +29,8 @@ export default connect(
|
||||
state => ({
|
||||
contentViewDescription: state.ui.flow.viewDescription,
|
||||
readonly: !state.ui.flow.modifiedFlow,
|
||||
})
|
||||
}),
|
||||
{
|
||||
uploadContent: uploadContent
|
||||
}
|
||||
)(ContentViewOptions)
|
||||
|
Loading…
Reference in New Issue
Block a user