export default function MeasureHeader(props /*: Props*/) {
const { branchLike, component, leakPeriod, measure, metric, secondaryMeasure } = props;
const isDiff = isDiffMetric(metric.key);
+ const hasHistory = component.qualifier !== 'FIL' && component.qualifier !== 'UTS';
return (
<div className="measure-details-header big-spacer-bottom">
<div className="measure-details-primary">
)}
</strong>
</span>
- {!isDiff && (
- <Tooltip
- overlay={translate('component_measures.show_metric_history')}
- placement="right">
- <Link
- className="js-show-history spacer-left button button-small"
- to={getMeasureHistoryUrl(component.key, metric.key, branchLike)}>
- <HistoryIcon />
- </Link>
- </Tooltip>
- )}
+ {!isDiff &&
+ hasHistory && (
+ <Tooltip
+ overlay={translate('component_measures.show_metric_history')}
+ placement="right">
+ <Link
+ className="js-show-history spacer-left button button-small"
+ to={getMeasureHistoryUrl(component.key, metric.key, branchLike)}>
+ <HistoryIcon />
+ </Link>
+ </Tooltip>
+ )}
</div>
<div className="measure-details-primary-actions">
{leakPeriod != null && (
).toMatchSnapshot();
});
+it('should not render link to activity page for files', () => {
+ expect(
+ shallow(<MeasureHeader {...PROPS} />)
+ .find('IconHistory')
+ .exists()
+ ).toBeTruthy();
+
+ expect(
+ shallow(<MeasureHeader {...PROPS} component={{ ...PROPS.component, qualifier: 'FIL' }} />)
+ .find('IconHistory')
+ .exists()
+ ).toBeFalsy();
+});
+
it('should display secondary measure too', () => {
const wrapper = shallow(<MeasureHeader {...PROPS} secondaryMeasure={SECONDARY} />);
expect(wrapper.find('Connect(LanguageDistribution)')).toHaveLength(1);