Skip to content
Snippets Groups Projects
Commit c50169de authored by Chris Beer's avatar Chris Beer
Browse files

Add continuous view to the selector

parent 048af1f6
Branches
Tags
No related merge requests found
...@@ -23,10 +23,11 @@ describe('WindowViewSettings', () => { ...@@ -23,10 +23,11 @@ describe('WindowViewSettings', () => {
const wrapper = createWrapper(); const wrapper = createWrapper();
expect(wrapper.find(ListSubheader).length).toBe(1); expect(wrapper.find(ListSubheader).length).toBe(1);
const labels = wrapper.find(FormControlLabel); const labels = wrapper.find(FormControlLabel);
expect(labels.length).toBe(3); expect(labels.length).toBe(4);
expect(labels.at(0).props().value).toBe('single'); expect(labels.at(0).props().value).toBe('single');
expect(labels.at(1).props().value).toBe('book'); expect(labels.at(1).props().value).toBe('book');
expect(labels.at(2).props().value).toBe('gallery'); expect(labels.at(2).props().value).toBe('scroll');
expect(labels.at(3).props().value).toBe('gallery');
}); });
it('should set the correct label active (by setting the secondary color)', () => { it('should set the correct label active (by setting the secondary color)', () => {
...@@ -37,8 +38,11 @@ describe('WindowViewSettings', () => { ...@@ -37,8 +38,11 @@ describe('WindowViewSettings', () => {
wrapper = createWrapper({ windowViewType: 'book' }); wrapper = createWrapper({ windowViewType: 'book' });
expect(wrapper.find(FormControlLabel).at(1).props().control.props.color).toEqual('secondary'); expect(wrapper.find(FormControlLabel).at(1).props().control.props.color).toEqual('secondary');
wrapper = createWrapper({ windowViewType: 'gallery' }); wrapper = createWrapper({ windowViewType: 'scroll' });
expect(wrapper.find(FormControlLabel).at(2).props().control.props.color).toEqual('secondary'); expect(wrapper.find(FormControlLabel).at(2).props().control.props.color).toEqual('secondary');
wrapper = createWrapper({ windowViewType: 'gallery' });
expect(wrapper.find(FormControlLabel).at(3).props().control.props.color).toEqual('secondary');
}); });
it('updates state when the view config selection changes', () => { it('updates state when the view config selection changes', () => {
...@@ -49,6 +53,8 @@ describe('WindowViewSettings', () => { ...@@ -49,6 +53,8 @@ describe('WindowViewSettings', () => {
wrapper.find(MenuItem).at(1).simulate('click'); wrapper.find(MenuItem).at(1).simulate('click');
expect(setWindowViewType).toHaveBeenCalledWith('xyz', 'book'); expect(setWindowViewType).toHaveBeenCalledWith('xyz', 'book');
wrapper.find(MenuItem).at(2).simulate('click'); wrapper.find(MenuItem).at(2).simulate('click');
expect(setWindowViewType).toHaveBeenCalledWith('xyz', 'scroll');
wrapper.find(MenuItem).at(3).simulate('click');
expect(setWindowViewType).toHaveBeenCalledWith('xyz', 'gallery'); expect(setWindowViewType).toHaveBeenCalledWith('xyz', 'gallery');
}); });
......
...@@ -84,6 +84,15 @@ export class WindowViewSettings extends Component { ...@@ -84,6 +84,15 @@ export class WindowViewSettings extends Component {
labelPlacement="bottom" labelPlacement="bottom"
/> />
</MenuItem> </MenuItem>
<MenuItem className={classes.MenuItem} onClick={() => { this.handleChange('scroll'); handleClose(); }}>
<FormControlLabel
value="scroll"
classes={{ label: windowViewType === 'scroll' ? classes.selectedLabel : classes.label }}
control={<BookViewIcon color={windowViewType === 'scroll' ? 'secondary' : undefined} />}
label={t('scroll')}
labelPlacement="bottom"
/>
</MenuItem>
<MenuItem className={classes.MenuItem} onClick={() => { this.handleChange('gallery'); handleClose(); }}> <MenuItem className={classes.MenuItem} onClick={() => { this.handleChange('gallery'); handleClose(); }}>
<FormControlLabel <FormControlLabel
value="gallery" value="gallery"
......
...@@ -29,7 +29,7 @@ export default class CanvasGroupings { ...@@ -29,7 +29,7 @@ export default class CanvasGroupings {
if (this._groupings) { // eslint-disable-line no-underscore-dangle if (this._groupings) { // eslint-disable-line no-underscore-dangle
return this._groupings; // eslint-disable-line no-underscore-dangle return this._groupings; // eslint-disable-line no-underscore-dangle
} }
if (this.viewType === 'continuous') { if (this.viewType === 'scroll') {
return [this.canvases]; return [this.canvases];
} }
if (this.viewType !== 'book') { if (this.viewType !== 'book') {
......
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
"retry": "Retry", "retry": "Retry",
"right": "Right", "right": "Right",
"rights": "License", "rights": "License",
"scroll": "Scroll",
"searchInputLabel": "search terms", "searchInputLabel": "search terms",
"searchNextResult": "Next result", "searchNextResult": "Next result",
"searchNoResults": "No results found", "searchNoResults": "No results found",
......
...@@ -88,7 +88,7 @@ export const getWindowViewType = createSelector( ...@@ -88,7 +88,7 @@ export const getWindowViewType = createSelector(
], ],
(window, manifestViewingHint, manifestBehaviors, defaultView) => { (window, manifestViewingHint, manifestBehaviors, defaultView) => {
const lookup = { const lookup = {
continuous: 'continuous', continuous: 'scroll',
individuals: 'single', individuals: 'single',
paged: 'book', paged: 'book',
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment