mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-27 23:35:15 +02:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import { assert } from 'chai';
|
|
import { describe, it } from 'mocha';
|
|
import React from 'react';
|
|
|
|
import NavigatorIntro from '../../../../../app/component/itinerary/navigator/navigatorintro/NavigatorIntro';
|
|
import {
|
|
mockChildContextTypes,
|
|
mockContext,
|
|
} from '../../../helpers/mock-context';
|
|
import { mountWithIntl } from '../../../helpers/mock-intl-enzyme';
|
|
|
|
const defaultProps = {
|
|
onClose: () => {},
|
|
onOpenGeolocationInfo: () => {},
|
|
};
|
|
|
|
describe('<NavigatorIntro />', () => {
|
|
it('should render logo if prop is present', () => {
|
|
const wrapper = mountWithIntl(
|
|
<NavigatorIntro logo="foobar" {...defaultProps} />,
|
|
{
|
|
context: {
|
|
...mockContext,
|
|
},
|
|
childContextTypes: { ...mockChildContextTypes },
|
|
},
|
|
);
|
|
|
|
expect(wrapper.find('div.intro-body img')).to.have.lengthOf(1);
|
|
});
|
|
|
|
it('should not render logo if prop is missing', () => {
|
|
const wrapper = mountWithIntl(<NavigatorIntro {...defaultProps} />, {
|
|
context: {
|
|
...mockContext,
|
|
},
|
|
childContextTypes: { ...mockChildContextTypes },
|
|
});
|
|
|
|
assert(wrapper.find('div.intro-body img'), undefined);
|
|
});
|
|
});
|