Skip to content

Commit

Permalink
AnalyticsSection fixes
Browse files Browse the repository at this point in the history
- fix responsive behavior with icon
- add missing AnalyticsSection branch coverage
  • Loading branch information
cee-chen committed Mar 3, 2021
1 parent 5e1fc00 commit 833476b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import React from 'react';

import { shallow } from 'enzyme';

import { EuiIcon } from '@elastic/eui';

import { AnalyticsSection } from './';

describe('AnalyticsSection', () => {
Expand All @@ -23,4 +25,12 @@ describe('AnalyticsSection', () => {
expect(wrapper.find('p').text()).toEqual('Dolor sit amet.');
expect(wrapper.find('[data-test-subj="HelloWorld"]')).toHaveLength(1);
});

it('renders an optional icon', () => {
const wrapper = shallow(
<AnalyticsSection title="Lorem ipsum" subtitle="Dolor sit amet." iconType="eye" />
);

expect(wrapper.find(EuiIcon).prop('type')).toEqual('eye');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ interface Props {
export const AnalyticsSection: React.FC<Props> = ({ title, subtitle, iconType, children }) => (
<section>
<header>
<EuiFlexGroup gutterSize="xs" alignItems="center" justifyContent="flexStart">
<EuiFlexGroup
gutterSize="xs"
alignItems="center"
justifyContent="flexStart"
responsive={false}
>
{iconType && (
<EuiFlexItem grow={false}>
<EuiIcon type={iconType} size="l" />
Expand Down

0 comments on commit 833476b

Please sign in to comment.