diff options
3 files changed, 65 insertions, 1 deletions
diff --git a/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js b/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js new file mode 100644 index 00000000..0b1e8538 --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/ContentViewOptionsSpec.js @@ -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() + }) +}) diff --git a/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap b/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap new file mode 100644 index 00000000..e3561ec1 --- /dev/null +++ b/web/src/js/__tests__/components/ContentView/__snapshots__/ContentViewOptionsSpec.js.snap @@ -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> +`; diff --git a/web/src/js/components/ContentView/ContentViewOptions.jsx b/web/src/js/components/ContentView/ContentViewOptions.jsx index e3cc39cd..109fb861 100644 --- a/web/src/js/components/ContentView/ContentViewOptions.jsx +++ b/web/src/js/components/ContentView/ContentViewOptions.jsx @@ -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) |