All files / components/result ResultCard.jsx

55.56% Statements 5/9
50% Branches 1/2
50% Functions 1/2
55.56% Lines 5/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43              1x                       25x 25x 25x                         1x                
import VueTypes from 'vue-types';
import types from '../../utils/vueTypes';
import ResultCardTitle from './addons/ResultCardTitle.jsx';
import ResultCardImage from './addons/ResultCardImage.jsx';
import ResultCardDescription from './addons/ResultCardDescription.jsx';
import Card from '../../styles/Card';
 
const ResultCard = {
	name: 'ResultCard',
	components: {
		ResultCardTitle,
		ResultCardImage,
		ResultCardDescription,
	},
	props: {
		target: VueTypes.string.def('_blank'),
		href: types.string,
	},
	render() {
		const children = this.$slots.default;
		const { href, target, ...rest } = this.$props;
		return (
			<Card
				href={href}
				target={target}
				rel={target === '_blank' ? 'noopener noreferrer' : null}
				{...rest}
			>
				{children}
			</Card>
		);
	},
};
 
ResultCard.install = function(Vue) {
	Vue.component(ResultCard.name, ResultCard);
	Vue.component(ResultCardTitle.name, ResultCardTitle);
	Vue.component(ResultCardImage.name, ResultCardImage);
	Vue.component(ResultCardDescription.name, ResultCardDescription);
};
 
export default ResultCard;