import * as React from 'react'; import { shallow } from 'enzyme'; import { colors } from '@uidu/theme'; import { Wrapper, LinkWrapper, IconWrapper, TextWrapper } from '../../styled'; describe('Wrapper', () => { it('should render with minWidth when there is a minWidth', () => { const element = shallow(); expect(element).toHaveStyleRule('min-width', '100px'); }); it('should not render with minWidth when there is no minWidth', () => { const element = shallow(); expect(element).not.toHaveStyleRule('min-width', ''); }); it('should render with minWidth when there is a minWidth', () => { const element = shallow(); expect(element).toHaveStyleRule('max-width', '100px'); }); it('should not render with minWidth when there is no minWidth', () => { const element = shallow(); expect(element).not.toHaveStyleRule('max-width', ''); }); it('should have hover styles when isInteractive=true', () => { const element = shallow(); expect(element).toMatchSnapshot(); }); it('should not have hover styles when isInteractive=false', () => { const element = shallow(); expect(element).toMatchSnapshot(); }); }); describe('LinkWrapper', () => { it('should render with minWidth when there is a minWidth', () => { const element = shallow(); expect(element).toHaveStyleRule('min-width', '100px'); }); it('should not render with minWidth when there is no minWidth', () => { const element = shallow(); expect(element).not.toHaveStyleRule('min-width', ''); }); it('should render with minWidth when there is a minWidth', () => { const element = shallow(); expect(element).toHaveStyleRule('max-width', '100px'); }); it('should not render with minWidth when there is no minWidth', () => { const element = shallow(); expect(element).not.toHaveStyleRule('max-width', ''); }); it('should have hover styles when isInteractive=true', () => { const element = shallow(); expect(element).toMatchSnapshot(); }); it('should not have hover styles when isInteractive=false', () => { const element = shallow(); expect(element).toMatchSnapshot(); }); }); describe('IconWrapper', () => { it('should look like a placeholder when isPlaceholder=true', () => { const element = shallow(); expect(element).toHaveStyleRule('background-color', colors.N30); }); it('should look like a placeholder when isPlaceholder=false', () => { const element = shallow(); expect(element).not.toHaveStyleRule('background-color', colors.N30); }); }); describe('TextWrapper', () => { it('should look like a placeholder when isPlaceholder=true', () => { const element = shallow(); expect(element).toHaveStyleRule('background-color', colors.N30); }); it('should look like a placeholder when isPlaceholder=false', () => { const element = shallow(); expect(element).not.toHaveStyleRule('background-color', colors.N30); }); });