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

Update tests to use the imported icon, not display labels

parent 031b6894
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { shallow } from 'enzyme';
import Slide from '@material-ui/core/Slide';
import ArrowLeftIcon from '@material-ui/icons/ArrowLeftSharp';
import ArrowRightIcon from '@material-ui/icons/ArrowRightSharp';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
import { CompanionArea } from '../../../src/components/CompanionArea';
import CompanionWindowFactory from '../../../src/containers/CompanionWindowFactory';
......@@ -69,7 +71,7 @@ describe('CompanionArea', () => {
});
expect(wrapper.find(MiradorMenuButton).length).toBe(1);
expect(wrapper.find(MiradorMenuButton).first().children('ArrowRightSharpIcon').length).toBe(1);
expect(wrapper.find(MiradorMenuButton).first().children(ArrowRightIcon).length).toBe(1);
expect(wrapper.find(Slide).prop('direction')).toBe('right');
expect(wrapper.find(MiradorMenuButton).prop('aria-expanded')).toBe(false);
expect(wrapper.find('div.mirador-companion-windows').length).toBe(1);
......@@ -91,7 +93,7 @@ describe('CompanionArea', () => {
});
expect(wrapper.find(MiradorMenuButton).length).toBe(1);
expect(wrapper.find(MiradorMenuButton).first().children('ArrowLeftSharpIcon').length).toBe(1);
expect(wrapper.find(MiradorMenuButton).first().children(ArrowLeftIcon).length).toBe(1);
expect(wrapper.find(MiradorMenuButton).prop('aria-expanded')).toBe(true);
expect(wrapper.find('div.mirador-companion-windows').length).toBe(1);
......
import React from 'react';
import { shallow } from 'enzyme';
import FullscreenIcon from '@material-ui/icons/FullscreenSharp';
import FullscreenExitIcon from '@material-ui/icons/FullscreenExitSharp';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
import { FullScreenButton } from '../../../src/components/FullScreenButton';
......@@ -36,7 +38,7 @@ describe('FullScreenButton', () => {
});
it('has the FullscreenIcon', () => {
expect(menuButton.children('FullscreenSharpIcon').length).toBe(1);
expect(menuButton.children(FullscreenIcon).length).toBe(1);
});
it('has the proper aria-label i18n key', () => {
......@@ -58,7 +60,7 @@ describe('FullScreenButton', () => {
});
it('has the FullscreenExitIcon', () => {
expect(menuButton.children('FullscreenExitSharpIcon').length).toBe(1);
expect(menuButton.children(FullscreenExitIcon).length).toBe(1);
});
it('has the proper aria-label', () => {
......
......@@ -2,6 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import ListItemText from '@material-ui/core/ListItemText';
import MenuItem from '@material-ui/core/MenuItem';
import CheckIcon from '@material-ui/icons/CheckSharp';
import { LanguageSettings } from '../../../src/components/LanguageSettings';
/**
......@@ -63,7 +64,7 @@ describe('LanguageSettings', () => {
wrapper
.find(MenuItem)
.first()
.find('CheckSharpIcon')
.find(CheckIcon)
.length,
).toBe(1);
});
......
......@@ -2,6 +2,8 @@ import React from 'react';
import { shallow } from 'enzyme';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import ExpandLessIcon from '@material-ui/icons/ExpandLessSharp';
import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp';
import MenuItem from '@material-ui/core/MenuItem';
import { NestedMenu } from '../../../src/components/NestedMenu';
......@@ -61,11 +63,11 @@ describe('NestedMenu', () => {
wrapper = createWrapper();
expect(wrapper.state().nestedMenuIsOpen).toBe(false);
expect(wrapper.find('ExpandMoreSharpIcon').length).toBe(1);
expect(wrapper.find('ExpandLessSharpIcon').length).toBe(0);
expect(wrapper.find(ExpandMoreIcon).length).toBe(1);
expect(wrapper.find(ExpandLessIcon).length).toBe(0);
wrapper.setState({ nestedMenuIsOpen: true });
expect(wrapper.find('ExpandMoreSharpIcon').length).toBe(0);
expect(wrapper.find('ExpandLessSharpIcon').length).toBe(1);
expect(wrapper.find(ExpandMoreIcon).length).toBe(0);
expect(wrapper.find(ExpandLessIcon).length).toBe(1);
});
it("renders the component's children based on the nestedMenuIsOpen state", () => {
......
......@@ -4,6 +4,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import CircularProgress from '@material-ui/core/CircularProgress';
import Input from '@material-ui/core/Input';
import TextField from '@material-ui/core/TextField';
import SearchIcon from '@material-ui/icons/SearchSharp';
import { SearchPanelControls } from '../../../src/components/SearchPanelControls';
/**
......@@ -56,7 +57,7 @@ describe('SearchPanelControls', () => {
.dive()
.dive();
expect(divedInput.find(CircularProgress).length).toEqual(0);
expect(divedInput.find('SearchSharpIcon').length).toEqual(1);
expect(divedInput.find(SearchIcon).length).toEqual(1);
expect(divedInput.find('Connect(WithPlugins(MiradorMenuButton))[type="submit"]').length).toEqual(1);
});
......
import React from 'react';
import { shallow } from 'enzyme';
import NavigationIcon from '@material-ui/icons/PlayCircleOutlineSharp';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
import { ViewerNavigation } from '../../../src/components/ViewerNavigation';
......@@ -89,8 +90,8 @@ describe('ViewerNavigation', () => {
});
it('changes the arrow styles', () => {
const previous = wrapper.find(MiradorMenuButton).first().children('PlayCircleOutlineSharpIcon').props();
const next = wrapper.find(MiradorMenuButton).last().children('PlayCircleOutlineSharpIcon').props();
const previous = wrapper.find(MiradorMenuButton).first().children(NavigationIcon).props();
const next = wrapper.find(MiradorMenuButton).last().children(NavigationIcon).props();
expect(previous.style).toEqual({});
expect(next.style).toEqual({ transform: 'rotate(180deg)' });
});
......@@ -112,8 +113,8 @@ describe('ViewerNavigation', () => {
});
it('changes the arrow styles', () => {
const previous = wrapper.find(MiradorMenuButton).first().children('PlayCircleOutlineSharpIcon').props();
const next = wrapper.find(MiradorMenuButton).last().children('PlayCircleOutlineSharpIcon').props();
const previous = wrapper.find(MiradorMenuButton).first().children(NavigationIcon).props();
const next = wrapper.find(MiradorMenuButton).last().children(NavigationIcon).props();
expect(previous.style).toEqual({ transform: 'rotate(270deg)' });
expect(next.style).toEqual({ transform: 'rotate(90deg)' });
});
......@@ -131,8 +132,8 @@ describe('ViewerNavigation', () => {
});
it('changes the arrow styles', () => {
const previous = wrapper.find(MiradorMenuButton).first().children('PlayCircleOutlineSharpIcon').props();
const next = wrapper.find(MiradorMenuButton).last().children('PlayCircleOutlineSharpIcon').props();
const previous = wrapper.find(MiradorMenuButton).first().children(NavigationIcon).props();
const next = wrapper.find(MiradorMenuButton).last().children(NavigationIcon).props();
expect(previous.style).toEqual({ transform: 'rotate(90deg)' });
expect(next.style).toEqual({ transform: 'rotate(270deg)' });
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment