All files / src/components/match LineupPitch.vue

100% Statements 35/35
80% Branches 4/5
100% Functions 0/0
100% Lines 35/35

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 44 45 46 47 481x 1x     1x 1x 1x 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x       1x 1x   1x         1x   1x 1x 4x 1x 1x    
<template>
  <!--
    One team's starting lineup, read-only (SB-1915): what a fan sees once a
    manager has set it. Drawn on the same dark pitch as live scoring.
  -->
  <div data-testid="lineup-pitch">
    <div
      v-if="!hasLineup"
      class="text-slate-300 text-sm text-center py-6"
      data-testid="lineup-not-set"
    >
      No lineup set for {{ teamName }} yet.
    </div>
    <template v-else>
      <p
        class="m-0 mb-2 text-xs font-semibold text-slate-300"
        data-testid="lineup-formation"
      >
        Formation {{ lineup.formation_name }}
      </p>
      <FormationField
        :formation="lineup.formation_name"
        :assignments="lineup.positions"
        :sport-type="sportType"
        readonly
      />
    </template>
  </div>
</template>
 
<script setup>
import { computed } from 'vue';
import FormationField from '../live/FormationField.vue';
 
const props = defineProps({
  /** GET /api/matches/{id}/lineup/{team}: formation_name + positions, or null. */
  lineup: { type: Object, default: null },
  teamName: { type: String, default: '' },
  sportType: { type: String, default: 'soccer' },
});
 
const hasLineup = computed(
  () =>
    Boolean(props.lineup?.formation_name) &&
    (props.lineup?.positions?.length || 0) > 0
);
</script>