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

Provide sr-only viewer info, now that it's used as the section/canvas label

parent fbb182c9
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { shallow } from 'enzyme';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import { WindowCanvasNavigationControls } from '../../../src/components/WindowCanvasNavigationControls';
import ViewerInfo from '../../../src/containers/ViewerInfo';
import ViewerNavigation from '../../../src/containers/ViewerNavigation';
......@@ -35,9 +36,9 @@ describe('WindowCanvasNavigationControls', () => {
)).toBe(true);
});
it('renders nothing when visible=false', () => {
it('renders only a screen-reader accessibile version when visible=false', () => {
wrapper = createWrapper({ visible: false });
expect(wrapper.matchesElement(<></>)).toBe(true);
expect(wrapper.matchesElement(<Typography variant="srOnly"><ViewerInfo /></Typography>)).toBe(true);
});
it('sets the proper class/ZoomControls prop dependent on the size/width prop', () => {
......
......@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import ZoomControls from '../containers/ZoomControls';
import ViewerInfo from '../containers/ViewerInfo';
import ViewerNavigation from '../containers/ViewerNavigation';
......@@ -26,7 +27,7 @@ export class WindowCanvasNavigationControls extends Component {
classes, visible, windowId, zoomToWorld,
} = this.props;
if (!visible) return (<></>);
if (!visible) return (<Typography variant="srOnly" component="div"><ViewerInfo windowId={windowId} /></Typography>);
return (
<Paper
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment