Skip to content
Snippets Groups Projects
Unverified Commit 364947b8 authored by Chris Beer's avatar Chris Beer Committed by GitHub
Browse files

Merge branch 'master' into 1782-embedded-integration-test

parents 910e78c4 ab917f46
Branches
Tags
No related merge requests found
Showing
with 338 additions and 114 deletions
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
canvasIndex: 2, canvasIndex: 2,
}, },
{ {
loadedManifest: 'https://media.nga.gov/public/manifests/nga_highlights.json', loadedManifest: 'https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json',
thumbnailNavigationPosition: 'off', thumbnailNavigationPosition: 'off',
}] }]
}); });
......
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { MuiThemeProvider } from '@material-ui/core/styles';
import Fullscreen from 'react-fullscreen-crossbrowser';
import WorkspaceControlPanel from '../../../src/components/WorkspaceControlPanel';
import Workspace from '../../../src/containers/Workspace';
import App from '../../../src/components/App'; import App from '../../../src/components/App';
describe('App', () => { /** */
it('renders without an error', () => { function createWrapper(props) {
const wrapper = shallow( return shallow(
<App <App
manifests={[]} isFullscreenEnabled={false}
workspace={{}} setWorkspaceFullscreen={() => {}}
config={{ theme: 'light' }} theme="light"
classes={{}}
{...props}
/>, />,
); ).dive(); // to unwrapp HOC created by withStyle()
expect(wrapper.dive().find('div.mirador-app').length).toBe(1); }
describe('App', () => {
it('should render outer element correctly', () => {
const wrapper = createWrapper();
expect(wrapper.find('div.mirador-app').length).toBe(1);
}); });
describe('FullScreen', () => { it('should render all needed elements ', () => {
it('is enabled by the workspace.fullscreen state', () => { const wrapper = createWrapper();
const wrapper = shallow( expect(wrapper.find(MuiThemeProvider).length).toBe(1);
<App expect(wrapper.find(Fullscreen).length).toBe(1);
manifests={[]} expect(wrapper.find(Workspace).length).toBe(1);
workspace={{ isFullscreenEnabled: true }} expect(wrapper.find(WorkspaceControlPanel).length).toBe(1);
config={{ theme: 'light' }}
/>,
);
expect(wrapper.dive().find('FullScreen').first().prop('enabled')).toEqual(true);
}); });
it('should pass setWorkspaceFullscreen to Fullscreen.onChange', () => {
const mockFn = jest.fn();
const wrapper = createWrapper({ setWorkspaceFullscreen: mockFn });
expect(wrapper.find(Fullscreen).first().prop('onChange'))
.toBe(mockFn);
});
it('should pass isFullscreenEnabled to Fullscreen.enabled', () => {
let wrapper = createWrapper({ isFullscreenEnabled: false });
expect(wrapper.find(Fullscreen).first().prop('enabled'))
.toEqual(false);
wrapper = createWrapper({ isFullscreenEnabled: true });
expect(wrapper.find(Fullscreen).first().prop('enabled'))
.toEqual(true);
}); });
}); });
...@@ -19,11 +19,9 @@ describe('ThumbnailNavigation', () => { ...@@ -19,11 +19,9 @@ describe('ThumbnailNavigation', () => {
); );
wrapper = shallow( wrapper = shallow(
<ThumbnailNavigation <ThumbnailNavigation
manifest={{ canvases={
id: 'http://foo', manifesto.create(manifestJson).getSequences()[0].getCanvases()
manifestation: manifesto.create(manifestJson), }
isFetching: false,
}}
window={{ window={{
id: 'foobar', id: 'foobar',
canvasIndex: 1, canvasIndex: 1,
......
...@@ -2,40 +2,27 @@ import React from 'react'; ...@@ -2,40 +2,27 @@ import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WindowIcon from '../../../src/components/WindowIcon'; import WindowIcon from '../../../src/components/WindowIcon';
describe('WindowIcon', () => { /** createWrapper */
let wrapper; function createWrapper(props) {
let manifestation; return shallow(
<WindowIcon
describe('without a manifestation', () => { manifestLogo=""
beforeEach(() => { classses={{}}
wrapper = shallow(<WindowIcon />).dive(); {...props}
}); />,
).dive(); // to unwrap HOC created by withStyles();
it('renders without an error', () => { }
expect(wrapper.find('img').length).toBe(0);
});
});
describe('with a manifestation without a logo', () => { describe('WindowIcon', () => {
beforeEach(() => { it('should render nothing if no manifest logo given', () => {
manifestation = { getLogo: () => null }; const wrapper = createWrapper();
wrapper = shallow(<WindowIcon manifestation={manifestation} />).dive();
});
it('renders without an error', () => {
expect(wrapper.find('img').length).toBe(0); expect(wrapper.find('img').length).toBe(0);
}); });
});
describe('with a manifestation with a logo', () => { it('should render logo if manifest logo is given', () => {
beforeEach(() => { const manifestLogo = 'http://foo.bar';
manifestation = { getLogo: () => 'http://example.com/thumbnail.jpg' }; const wrapper = createWrapper({ manifestLogo });
wrapper = shallow(<WindowIcon manifestation={manifestation} classes={{ logo: 'logo-class' }} />).dive(); expect(wrapper.find('img').first().prop('src'))
}); .toEqual(manifestLogo);
it('renders without an error', () => {
expect(wrapper.find('img.logo-class[src="http://example.com/thumbnail.jpg"]').length).toBe(1);
});
}); });
}); });
...@@ -49,7 +49,7 @@ describe('WindowList', () => { ...@@ -49,7 +49,7 @@ describe('WindowList', () => {
expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1); expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1);
expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz'); expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz');
expect( expect(
wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem>[Untitled]</MenuItem>), wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem>untitled</MenuItem>),
).toBe(true); ).toBe(true);
wrapper.find('WithStyles(MenuItem)').simulate('click', {}); wrapper.find('WithStyles(MenuItem)').simulate('click', {});
expect(handleClose).toBeCalled(); expect(handleClose).toBeCalled();
......
...@@ -18,7 +18,7 @@ describe('WindowSideBarButtons', () => { ...@@ -18,7 +18,7 @@ describe('WindowSideBarButtons', () => {
<WindowSideBarButtons toggleWindowSideBarPanel={toggleWindowSideBarPanel} />, <WindowSideBarButtons toggleWindowSideBarPanel={toggleWindowSideBarPanel} />,
); );
const iconButton = wrapper.find('WithStyles(IconButton)[aria-label="Open information companion window"]'); const iconButton = wrapper.find('WithStyles(IconButton)[aria-label="openInfoCompanionWindow"]');
expect(iconButton.simulate('click')); expect(iconButton.simulate('click'));
expect(toggleWindowSideBarPanel).toHaveBeenCalledTimes(1); expect(toggleWindowSideBarPanel).toHaveBeenCalledTimes(1);
expect(toggleWindowSideBarPanel).toHaveBeenCalledWith('info'); expect(toggleWindowSideBarPanel).toHaveBeenCalledWith('info');
......
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Typography from '@material-ui/core/Typography';
import createStore from '../../../src/state/createStore'; import createStore from '../../../src/state/createStore';
import * as actions from '../../../src/state/actions'; import * as actions from '../../../src/state/actions';
import WindowSideBarInfoPanel from '../../../src/components/WindowSideBarInfoPanel'; import WindowSideBarInfoPanel from '../../../src/components/WindowSideBarInfoPanel';
...@@ -13,12 +14,28 @@ describe('WindowSideBarInfoPanel', () => { ...@@ -13,12 +14,28 @@ describe('WindowSideBarInfoPanel', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch(actions.receiveManifest('foo', fixture)); store.dispatch(actions.receiveManifest('foo', fixture));
manifest = store.getState().manifests.foo; manifest = store.getState().manifests.foo;
wrapper = shallow(<WindowSideBarInfoPanel manifest={manifest} />); wrapper = shallow(
<WindowSideBarInfoPanel manifest={manifest} />,
).dive();
}); });
it('renders without an error', () => { it('renders without an error', () => {
expect(wrapper.find('h2').text()).toBe('About this item'); expect(
expect(wrapper.find('h3').text()).toBe('Bodleian Library Human Freaks 2 (33)'); wrapper.find('WithStyles(Typography)[variant="h2"]').first().matchesElement(
expect(wrapper.find('.mirador-window-sidebar-info-panel div').text()).toBe('[Handbill of Mr. Becket, [1787] ]'); <Typography>aboutThisItem</Typography>,
),
).toBe(true);
expect(
wrapper.find('WithStyles(Typography)[variant="h3"]').first().matchesElement(
<Typography>Bodleian Library Human Freaks 2 (33)</Typography>,
),
).toBe(true);
expect(
wrapper.find('WithStyles(Typography)[variant="body2"]').first().matchesElement(
<Typography>[Handbill of Mr. Becket, [1787] ]</Typography>,
),
).toBe(true);
}); });
}); });
...@@ -3,6 +3,7 @@ import { shallow } from 'enzyme'; ...@@ -3,6 +3,7 @@ import { shallow } from 'enzyme';
import createStore from '../../../src/state/createStore'; import createStore from '../../../src/state/createStore';
import * as actions from '../../../src/state/actions'; import * as actions from '../../../src/state/actions';
import WindowSideBarPanel from '../../../src/components/WindowSideBarPanel'; import WindowSideBarPanel from '../../../src/components/WindowSideBarPanel';
import WindowSideBarInfoPanel from '../../../src/containers/WindowSideBarInfoPanel';
import fixture from '../../fixtures/version-2/001.json'; import fixture from '../../fixtures/version-2/001.json';
describe('WindowSideBarPanel', () => { describe('WindowSideBarPanel', () => {
...@@ -21,7 +22,7 @@ describe('WindowSideBarPanel', () => { ...@@ -21,7 +22,7 @@ describe('WindowSideBarPanel', () => {
}); });
it('renders the WindowSideBarInfoPanel', () => { it('renders the WindowSideBarInfoPanel', () => {
expect(wrapper.find('WindowSideBarInfoPanel').length).toBe(1); expect(wrapper.find(WindowSideBarInfoPanel).length).toBe(1);
}); });
}); });
...@@ -31,7 +32,7 @@ describe('WindowSideBarPanel', () => { ...@@ -31,7 +32,7 @@ describe('WindowSideBarPanel', () => {
}); });
it('does not render any panel component', () => { it('does not render any panel component', () => {
expect(wrapper.find('WindowSideBarInfoPanel').length).toBe(0); expect(wrapper.find(WindowSideBarInfoPanel).length).toBe(0);
}); });
}); });
}); });
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import RadioGroup from '@material-ui/core/RadioGroup';
import Typography from '@material-ui/core/Typography';
import WindowThumbnailSettings from '../../../src/components/WindowThumbnailSettings'; import WindowThumbnailSettings from '../../../src/components/WindowThumbnailSettings';
describe('WindowThumbnailSettings', () => { /** create wrapper */
let wrapper; function createWrapper(props) {
const setWindowThumbnailPosition = jest.fn(); return shallow(
beforeEach(() => {
wrapper = shallow(
<WindowThumbnailSettings <WindowThumbnailSettings
windowId="xyz" windowId="xyz"
setWindowThumbnailPosition={setWindowThumbnailPosition} setWindowThumbnailPosition={() => {}}
thumbnailNavigationPosition="bottom" thumbnailNavigationPosition="off"
{...props}
/>, />,
); );
}
describe('WindowThumbnailSettings', () => {
it('renders all elements correctly', () => {
const wrapper = createWrapper();
expect(wrapper.find(Typography).length).toBe(1);
expect(wrapper.find(RadioGroup).length).toBe(1);
const labels = wrapper.find(FormControlLabel);
expect(labels.length).toBe(3);
expect(labels.at(0).props().value).toBe('off');
expect(labels.at(1).props().value).toBe('bottom');
expect(labels.at(2).props().value).toBe('right');
}); });
it('renders without an error', () => { it('should set the correct label active', () => {
expect(wrapper.find('WithStyles(Typography)').dive().dive().text()).toBe('Thumbnails'); let wrapper = createWrapper({ thumbnailNavigationPosition: 'bottom' });
expect(wrapper.find('RadioGroup').props().value).toBe('bottom'); expect(wrapper.find(RadioGroup).props().value).toBe('bottom');
wrapper = createWrapper({ thumbnailNavigationPosition: 'right' });
expect(wrapper.find(RadioGroup).props().value).toBe('right');
}); });
it('updates state when the thumbnail config selection changes', () => { it('updates state when the thumbnail config selection changes', () => {
wrapper.find('RadioGroup').first().simulate('change', { target: { value: 'off' } }); const setWindowThumbnailPosition = jest.fn();
const wrapper = createWrapper({ setWindowThumbnailPosition });
wrapper.find(RadioGroup).first().simulate('change', { target: { value: 'off' } });
expect(setWindowThumbnailPosition).toHaveBeenCalledWith('xyz', 'off'); expect(setWindowThumbnailPosition).toHaveBeenCalledWith('xyz', 'off');
wrapper.find(RadioGroup).first().simulate('change', { target: { value: 'right' } });
expect(setWindowThumbnailPosition).toHaveBeenCalledWith('xyz', 'right');
}); });
}); });
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WindowTopBar from '../../../src/components/WindowTopBar'; import WindowTopBar from '../../../src/components/WindowTopBar';
import WindowIcon from '../../../src/containers/WindowIcon';
const manifestFixture = { const manifestFixture = {
manifestation: { manifestation: {
...@@ -23,6 +24,7 @@ describe('WindowTopBar', () => { ...@@ -23,6 +24,7 @@ describe('WindowTopBar', () => {
removeWindow={mockRemoveWindow} removeWindow={mockRemoveWindow}
toggleWindowSideBar={mockToggleWindowSideBar} toggleWindowSideBar={mockToggleWindowSideBar}
classes={{}} classes={{}}
t={key => key}
/>, />,
).dive(); ).dive();
}); });
...@@ -37,7 +39,7 @@ describe('WindowTopBar', () => { ...@@ -37,7 +39,7 @@ describe('WindowTopBar', () => {
}); });
it('renders a window icon', () => { it('renders a window icon', () => {
expect(topBar.find('WithStyles(WindowIcon)').length).toBe(1); expect(topBar.find(WindowIcon).length).toBe(1);
}); });
it('calls the toggleWindowSideBar prop when the menu IconButton is clicked', () => { it('calls the toggleWindowSideBar prop when the menu IconButton is clicked', () => {
......
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import ListItem from '@material-ui/core/ListItem';
import Menu from '@material-ui/core/Menu';
import Divider from '@material-ui/core/Divider';
import WindowThumbnailSettings from '../../../src/containers/WindowThumbnailSettings';
import WindowTopMenu from '../../../src/components/WindowTopMenu'; import WindowTopMenu from '../../../src/components/WindowTopMenu';
/** create wrapper */
function createWrapper(props) {
return shallow(
<WindowTopMenu
windowId="xyz"
handleClose={() => {}}
anchorEl={null}
{...props}
/>,
);
}
describe('WindowTopMenu', () => { describe('WindowTopMenu', () => {
let wrapper; it('renders all needed elements', () => {
let handleClose; const wrapper = createWrapper();
beforeEach(() => { expect(wrapper.find(Menu).length).toBe(1);
handleClose = jest.fn(); expect(wrapper.find(ListItem).length).toBe(1);
wrapper = shallow(<WindowTopMenu windowId="xyz" handleClose={handleClose} />).dive(); expect(wrapper.find(WindowThumbnailSettings).length).toBe(1);
expect(wrapper.find(Divider).length).toBe(1);
});
it('passes windowId to <WindowThumbnailSettings/>', () => {
const wrapper = createWrapper();
expect(wrapper.find(WindowThumbnailSettings)
.first().props().windowId).toBe('xyz');
});
it('passses correct props to <Menu/> when no achor element given', () => {
const handleClose = jest.fn();
const wrapper = createWrapper({ handleClose });
expect(wrapper.find(Menu).first().props().anchorEl).toBe(null);
expect(wrapper.find(Menu).first().props().open).toBe(false);
expect(wrapper.find(Menu).first().props().onClose).toBe(handleClose);
}); });
it('renders without an error', () => { it('passses correct props to <Menu/> when no achor element given', () => {
expect(wrapper.find('WithStyles(Menu)').length).toBe(1); const handleClose = jest.fn();
expect(wrapper.find('Connect(WindowThumbnailSettings)').length).toBe(1); const anchorEl = {};
const wrapper = createWrapper({ anchorEl, handleClose });
expect(wrapper.find(Menu).first().props().anchorEl).toBe(anchorEl);
expect(wrapper.find(Menu).first().props().open).toBe(true);
expect(wrapper.find(Menu).first().props().onClose).toBe(handleClose);
}); });
}); });
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WindowTopMenuButton from '../../../src/components/WindowTopMenuButton'; import WindowTopMenuButton from '../../../src/components/WindowTopMenuButton';
import WindowTopMenu from '../../../src/containers/WindowTopMenu';
describe('WindowTopMenuButton', () => { describe('WindowTopMenuButton', () => {
let wrapper; let wrapper;
...@@ -15,6 +16,6 @@ describe('WindowTopMenuButton', () => { ...@@ -15,6 +16,6 @@ describe('WindowTopMenuButton', () => {
}); });
it('when clicked, updates the state', () => { it('when clicked, updates the state', () => {
wrapper.find('WithStyles(IconButton)').simulate('click', { currentTarget: 'x' }); wrapper.find('WithStyles(IconButton)').simulate('click', { currentTarget: 'x' });
expect(wrapper.find('Connect(miradorWithPlugins(WithStyles(WindowTopMenu)))').props().anchorEl).toBe('x'); expect(wrapper.find(WindowTopMenu).props().anchorEl).toBe('x');
}); });
}); });
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WorkspaceFullScreenButton from '../../../src/containers/WorkspaceFullScreenButton';
import WorkspaceControlPanelButtons import WorkspaceControlPanelButtons
from '../../../src/components/WorkspaceControlPanelButtons'; from '../../../src/components/WorkspaceControlPanelButtons';
...@@ -11,6 +12,6 @@ describe('WorkspaceControlPanelButtons', () => { ...@@ -11,6 +12,6 @@ describe('WorkspaceControlPanelButtons', () => {
it('renders without an error', () => { it('renders without an error', () => {
expect(wrapper.find('WithStyles(List)').length).toBe(1); expect(wrapper.find('WithStyles(List)').length).toBe(1);
expect(wrapper.find('Connect(WithStyles(WorkspaceFullScreenButton))').length).toBe(1); expect(wrapper.find(WorkspaceFullScreenButton).length).toBe(1);
}); });
}); });
...@@ -8,7 +8,10 @@ describe('WorkspaceFullScreenButton', () => { ...@@ -8,7 +8,10 @@ describe('WorkspaceFullScreenButton', () => {
beforeEach(() => { beforeEach(() => {
setWorkspaceFullscreen = jest.fn(); setWorkspaceFullscreen = jest.fn();
wrapper = shallow( wrapper = shallow(
<WorkspaceFullScreenButton classes={{}} setWorkspaceFullscreen={setWorkspaceFullscreen} />, <WorkspaceFullScreenButton
classes={{}}
setWorkspaceFullscreen={setWorkspaceFullscreen}
/>,
).dive(); ).dive();
}); });
......
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WorkspaceMenu from '../../../src/components/WorkspaceMenu'; import WorkspaceMenu from '../../../src/components/WorkspaceMenu';
import WindowList from '../../../src/containers/WindowList';
describe('WorkspaceMenu', () => { describe('WorkspaceMenu', () => {
let wrapper; let wrapper;
...@@ -23,15 +24,14 @@ describe('WorkspaceMenu', () => { ...@@ -23,15 +24,14 @@ describe('WorkspaceMenu', () => {
it('sets the anchor state', () => { it('sets the anchor state', () => {
wrapper.instance().handleMenuItemClick('windowList', { currentTarget: true }); wrapper.instance().handleMenuItemClick('windowList', { currentTarget: true });
expect(wrapper.find('Connect(WindowList)').props().open).toBe(true); expect(wrapper.find(WindowList).props().open).toBe(true);
}); });
}); });
describe('handleMenuItemClose', () => { describe('handleMenuItemClose', () => {
it('resets the anchor state', () => { it('resets the anchor state', () => {
wrapper.instance().handleMenuItemClose('windowList')(); wrapper.instance().handleMenuItemClose('windowList')();
expect(wrapper.find(WindowList).props().open).toBe(false);
expect(wrapper.find('Connect(WindowList)').props().open).toBe(false);
}); });
}); });
}); });
import manifesto from 'manifesto.js';
import manifestFixture from '../../fixtures/version-2/001.json';
import {
getWindowManifest,
getManifestLogo,
getManifestCanvases,
getThumbnailNavigationPosition,
} from '../../../src/state/selectors';
describe('getWindowManifest()', () => {
const state = {
windows: {
a: { id: 'a', manifestId: 'x' },
b: { id: 'b', manifestId: 'y' },
c: { id: 'c' },
},
manifests: {
x: { id: 'x' },
},
};
it('should return the manifest of a certain window', () => {
const received = getWindowManifest(state, 'a');
const expected = { id: 'x' };
expect(received).toEqual(expected);
});
it('should return undefined if window doesnt exist', () => {
const received = getWindowManifest(state, 'unknown');
expect(received).toBeUndefined();
});
it('should return undefined if window has no manifest id', () => {
const received = getWindowManifest(state, 'c');
expect(received).toBeUndefined();
});
it('should return undefined if manifest does not exist', () => {
const received = getWindowManifest(state, 'b');
expect(received).toBeUndefined();
});
});
describe('getManifestLogo()', () => {
it('should return manifest logo id', () => {
const manifest = { manifestation: manifesto.create(manifestFixture) };
const received = getManifestLogo(manifest);
expect(received).toEqual(manifestFixture.logo['@id']);
});
it('should return null if manifest has no logo', () => {
const manifest = { manifestation: manifesto.create({}) };
const received = getManifestLogo(manifest);
expect(received).toBeNull();
});
});
describe('getManifestCanvases', () => {
it('returns an empty array if the manifestation is not loaded', () => {
const manifest = {};
const received = getManifestCanvases(manifest);
expect(received).toEqual([]);
});
it('returns canvases from the manifest', () => {
const manifest = { manifestation: manifesto.create(manifestFixture) };
const received = getManifestCanvases(manifest);
expect(received.length).toBe(1);
expect(received[0].id).toBe('https://iiif.bodleian.ox.ac.uk/iiif/canvas/9cca8fdd-4a61-4429-8ac1-f648764b4d6d.json');
});
});
describe('getThumbnailNavigationPosition', () => {
const state = {
windows: {
a: { id: 'a', thumbnailNavigationPosition: 'bottom' },
b: { id: 'b' },
},
};
it('should return thumbnail navigation position if window exists', () => {
const received = getThumbnailNavigationPosition(state, 'a');
expect(received).toBe('bottom');
});
it('should return undefined if position does not exist in window', () => {
const received = getThumbnailNavigationPosition(state, 'b');
expect(received).toBeUndefined();
});
it('should return undefined if window does not exists', () => {
const received = getThumbnailNavigationPosition(state, 'c');
expect(received).toBeUndefined();
});
});
{
"translation": {
"aboutThisItem": "About this item",
"add": "Add",
"bottom": "Bottom",
"closeInfoCompanionWindow": "Close information companion window",
"closeMenu": "Close Menu",
"closeWindow": "Close window",
"dark": "Dark",
"downloadExport": "Download/Export",
"downloadExportWorkspace": "Download/export workspace",
"fetchManifest": "Fetch Manifest",
"fullScreen": "Full Screen",
"light": "Light",
"listAllOpenWindows": "List all open windows",
"menu": "Menu",
"off": "Off",
"openInfoCompanionWindow": "Open information companion window",
"openWindows": "Open windows",
"position": "Position",
"right": "Right",
"settings": "Settings",
"theme": "Theme",
"thumbnails": "Thumbnails",
"toggleWindowSideBar": "Toggle window sidebar",
"untitled": "[Untitled]"
}
}
...@@ -13,28 +13,34 @@ import ns from '../config/css-ns'; ...@@ -13,28 +13,34 @@ import ns from '../config/css-ns';
*/ */
class App extends Component { class App extends Component {
/** /**
* render
* @return {String} - HTML markup for the component
*/ */
render() { makeMuiTheme() {
const { const { theme } = this.props;
workspace, setWorkspaceFullscreen, config, classes, return createMuiTheme({
} = this.props;
const theme = createMuiTheme({
palette: { palette: {
type: config.theme, type: theme,
}, },
typography: { typography: {
useNextVariants: true, useNextVariants: true,
}, },
}); });
}
/**
* render
* @return {String} - HTML markup for the component
*/
render() {
const {
isFullscreenEnabled, setWorkspaceFullscreen, classes,
} = this.props;
return ( return (
<div className={classNames(classes.background, ns('app'))}> <div className={classNames(classes.background, ns('app'))}>
<MuiThemeProvider theme={theme}> <MuiThemeProvider theme={this.makeMuiTheme()}>
<Fullscreen <Fullscreen
enabled={workspace.isFullscreenEnabled} enabled={isFullscreenEnabled}
onChange={isFullscreenEnabled => setWorkspaceFullscreen(isFullscreenEnabled)} onChange={setWorkspaceFullscreen}
> >
<Workspace /> <Workspace />
</Fullscreen> </Fullscreen>
...@@ -46,17 +52,15 @@ class App extends Component { ...@@ -46,17 +52,15 @@ class App extends Component {
} }
App.propTypes = { App.propTypes = {
config: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types theme: PropTypes.string.isRequired, // eslint-disable-line react/forbid-prop-types
workspace: PropTypes.object, // eslint-disable-line react/forbid-prop-types isFullscreenEnabled: PropTypes.bool, // eslint-disable-line react/forbid-prop-types
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types, classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types,
setWorkspaceFullscreen: PropTypes.func, setWorkspaceFullscreen: PropTypes.func.isRequired,
}; };
App.defaultProps = { App.defaultProps = {
workspace: {}, isFullscreenEnabled: false,
setWorkspaceFullscreen: () => {},
}; };
/** /**
Material UI style overrides Material UI style overrides
@private @private
......
...@@ -52,6 +52,7 @@ class ManifestForm extends Component { ...@@ -52,6 +52,7 @@ class ManifestForm extends Component {
*/ */
render() { render() {
const { formValue } = this.state; const { formValue } = this.state;
const { t } = this.props;
return ( return (
<form onSubmit={this.formSubmit}> <form onSubmit={this.formSubmit}>
<input <input
...@@ -60,7 +61,7 @@ class ManifestForm extends Component { ...@@ -60,7 +61,7 @@ class ManifestForm extends Component {
type="text" type="text"
onChange={this.handleInputChange} onChange={this.handleInputChange}
/> />
<button id="fetchBtn" type="submit">FetchManifest</button> <button id="fetchBtn" type="submit">{t('fetchManifest')}</button>
</form> </form>
); );
} }
...@@ -69,6 +70,11 @@ class ManifestForm extends Component { ...@@ -69,6 +70,11 @@ class ManifestForm extends Component {
ManifestForm.propTypes = { ManifestForm.propTypes = {
fetchManifest: PropTypes.func.isRequired, fetchManifest: PropTypes.func.isRequired,
setLastRequested: PropTypes.func.isRequired, setLastRequested: PropTypes.func.isRequired,
t: PropTypes.func,
};
ManifestForm.defaultProps = {
t: key => key,
}; };
export default ManifestForm; export default ManifestForm;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment