Skip to content
Snippets Groups Projects
Commit 7fb937b8 authored by Jessie Keck's avatar Jessie Keck
Browse files

Disable window list header and select the first one in the list below

parent 2ddc6c24
No related branches found
No related tags found
No related merge requests found
......@@ -84,4 +84,30 @@ describe('WindowList', () => {
).toBe(true);
});
});
describe('with multiple windows', () => {
beforeEach(() => {
windows = {
zyx: { id: 'zyx', manifestId: '123' },
xyz: { id: 'xyz', manifestId: 'abc' },
};
manifests = { abc: { manifestation: { getLabel: jest.fn(() => [{ value: 'Some title' }]) } } };
wrapper = shallow(
<WindowList
containerId="mirador"
anchorEl={{}}
manifests={manifests}
windows={windows}
handleClose={handleClose}
focusWindow={focusWindow}
/>,
);
});
it('has the first window in the list selected', () => {
expect(wrapper.find('WithStyles(MenuItem)').first().props().selected).toBe(true);
expect(wrapper.find('WithStyles(MenuItem)').last().props().selected).toBe(false);
});
});
});
......@@ -39,13 +39,14 @@ export class WindowList extends Component {
open={Boolean(anchorEl)}
onClose={handleClose}
>
<ListSubheader>
<ListSubheader role="presentation" selected={false} disabled tabIndex="-1">
{t('openWindows')}
</ListSubheader>
{
Object.values(windows).map(window => (
Object.values(windows).map((window, i) => (
<MenuItem
key={window.id}
selected={i === 0}
onClick={(e) => { focusWindow(window.id); handleClose(e); }}
>
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment