Skip to content
Snippets Groups Projects
Commit a928a94a authored by Shaun Ellis's avatar Shaun Ellis Committed by Jack Reed
Browse files

WIP - begins to add tests for issue #41

parent 606d7033
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { shallow } from 'enzyme';
import { store } from '../../../src/store';
import Workspace from '../../../src/components/Workspace';
describe('Workspace', () => {
it('renders without an error', () => {
const wrapper = shallow(<Workspace store={store} />).dive();
expect(wrapper.find('div.mirador-workspace').length).toBe(1);
expect(wrapper.find('div.window').length).toBe(0);
// expect(wrapper.find('button').length).toBe(1);
// expect(wrapper.find('button').text()).toEqual('http://example.com');
});
// it('updates and adds window div when window is added to store', () => {
// const wrapper = shallow(<Workspace store={store} />).dive();
// expect(store.getState().windows.length).toEqual(0);
// wrapper.find('button').simulate('click');
// expect(store.getState().windows.length).toEqual(1);
// });
});
...@@ -5,6 +5,7 @@ import { actions } from '../store'; ...@@ -5,6 +5,7 @@ import { actions } from '../store';
import Display from './Display'; import Display from './Display';
import ManifestForm from './ManifestForm'; import ManifestForm from './ManifestForm';
import ManifestListItem from './ManifestListItem'; import ManifestListItem from './ManifestListItem';
import Workspace from './Workspace';
/** /**
* This is the top level Mirador component. * This is the top level Mirador component.
...@@ -72,6 +73,7 @@ class App extends Component { ...@@ -72,6 +73,7 @@ class App extends Component {
<Display <Display
manifest={this.props.manifests[this.state.lastRequested]} manifest={this.props.manifests[this.state.lastRequested]}
/> />
<Workspace />
</div> </div>
); );
} }
......
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
// import { actions } from '../store';
// import Window from './Window';
/**
* Represents a work area that contains any number of windows
* @memberof Workspace
* @private
*/
const Workspace = ({ windows }) => (
// const Workspace = ({ windows, manifests }) => (
<div className="mirador-workspace">
{
windows.map(window => (
<div className="window" key={window.id}>{window.id}</div>
// <Window
// key={window.id}
// windowId={window.id}
// manifest={manifests[window.manifestId]}
// />
))
}
</div>
);
Workspace.propTypes = {
windows: PropTypes.instanceOf(Array).isRequired, // manifests: PropTypes.instanceOf(Array),
};
/**
* mapStateToProps - to hook up connect
* @memberof Workspace
* @private
*/
const mapStateToProps = state => (
{
windows: state.windows, // manifests: state.manifests
}
);
// const mapDispatchToProps = dispatch => ({});
export default connect(mapStateToProps)(Workspace); // mapDispatchToProps,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment