All files / apps/developer-portal/layers/workflows/app/components/wizard Step.vue

77.77% Statements 14/18
100% Branches 30/30
55.55% Functions 5/9
77.77% Lines 14/18

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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87    2x 2x             1x       9x   2x                     3x       2x                                                                               17x           17x 17x 17x 17x 17x 17x        
<template>
    <header>
        <h2 class="text-lg font-semibold">{{ step.question }}</h2>
        <p class="text-sm text-muted">{{ step.hint }}</p>
    </header>
 
    <WorkflowTemplatePicker
        v-if="step.id === 'template'"
        :templates
        :model-value="templateId"
        @update:model-value="emit('pickTemplate', $event)"
    />
    <WizardDetails
        v-else-if="step.id === 'details'"
        v-model:title="title"
        v-model:summary="summary"
        v-model:id="id"
        v-model:milestone="milestone"
        v-model:area="area"
        :id-error
        :milestone-error
        @submit="emit('submit')"
    />
    <WorkflowFeaturePicker
        v-else-if="step.id === 'features' && template"
        :features
        editable
        @toggle="(feature, on) => emit('toggle', feature, on)"
    />
    <WorkflowPagePicker
        v-else-if="step.id === 'pages' && template"
        v-model="pages"
        :template
        :errors="pageErrors"
    />
    <WizardReview v-else :rows="review" :preview />
</template>
 
<script setup lang="ts">
import type {
    Feature,
    ProjectView,
    ReviewRow,
    Template,
} from "#layers/workflows/shared/workflows.ts";
 
interface Props {
    step: { id: string; question: string; hint: string };
    templates: Template[];
    templateId: string;
    template: Template | undefined;
    idError?: string;
    milestoneError?: string;
    features: Feature[];
    pageErrors: (string | null)[];
    review: ReviewRow[];
    preview: ProjectView | null;
}
 
const {
    step,
    templates,
    templateId,
    template,
    idError,
    milestoneError,
    features,
    pageErrors,
    review,
    preview,
} = defineProps<Props>();
const emit = defineEmits<{
    pickTemplate: [template: string];
    toggle: [feature: string, on: boolean];
    submit: [];
}>();
 
const title = defineModel<string>("title", { required: true });
const summary = defineModel<string>("summary", { required: true });
const id = defineModel<string>("id", { required: true });
const milestone = defineModel<string>("milestone", { required: true });
const area = defineModel<string>("area", { required: true });
const pages = defineModel<{ key: number; type: string; title: string }[]>("pages", {
    required: true,
});
</script>