diff --git a/__tests__/src/components/WorkspaceAdd.test.js b/__tests__/src/components/WorkspaceAdd.test.js index 1c600f9f1b..91fda9666f 100644 --- a/__tests__/src/components/WorkspaceAdd.test.js +++ b/__tests__/src/components/WorkspaceAdd.test.js @@ -27,6 +27,12 @@ describe('WorkspaceAdd', () => { expect(wrapper.find(ManifestListItem).length).toBe(2); }); + it('without manifests, renders an empty message', () => { + const wrapper = createWrapper({ manifests: {} }); + expect(wrapper.find(ManifestListItem).length).toEqual(0); + expect(wrapper.find('WithStyles(Typography)').first().children().text()).toEqual('emptyResourceList'); + }); + it('toggles the workspace visibility', () => { const setWorkspaceAddVisibility = jest.fn(); const wrapper = createWrapper({ setWorkspaceAddVisibility }); diff --git a/src/components/WorkspaceAdd.js b/src/components/WorkspaceAdd.js index 8cef253ea6..035ccf4d23 100644 --- a/src/components/WorkspaceAdd.js +++ b/src/components/WorkspaceAdd.js @@ -5,6 +5,7 @@ import AddIcon from '@material-ui/icons/AddSharp'; import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp'; import AppBar from '@material-ui/core/AppBar'; import Drawer from '@material-ui/core/Drawer'; +import Grid from '@material-ui/core/Grid'; import Fab from '@material-ui/core/Fab'; import List from '@material-ui/core/List'; import Paper from '@material-ui/core/Paper'; @@ -56,13 +57,35 @@ export class WorkspaceAdd extends React.Component { return (
- - {t('miradorResources')} - - {manifestList} - - - + {(Object.keys(manifests).length < 1) ? ( + + + + {t('emptyResourceList')} + + + + ) : ( + + {t('miradorResources')} + + {manifestList} + + + )}