Joaquín Sánchez bdedbc2c19
feat(ui): add summary (#493)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-01-18 13:53:27 +08:00

59 lines
1.5 KiB
Vue

<script setup lang="ts">
import { tests, testsFailed, testsSkipped, testsSuccess, testsTodo } from '../../composables/summary'
const total = computed(() => tests.value.length)
const pass = computed(() => testsSuccess.value.length)
const failed = computed(() => testsFailed.value.length)
const skipped = computed(() => testsSkipped.value.length)
const todo = computed(() => testsTodo.value.length)
const pending = computed(() => {
const t = unref(total)
return t - failed.value - pass.value
})
</script>
<template>
<div flex="~ wrap" justify-evenly gap-2 p="x-4" relative>
<DashboardEntry text-green5>
<template #header>
Pass
</template>
<template #body>
{{ pass }}
</template>
</DashboardEntry>
<DashboardEntry :class="{ 'text-red5': failed, 'op50': !failed }">
<template #header>
Fail
</template>
<template #body>
{{ failed }}
</template>
</DashboardEntry>
<DashboardEntry v-if="skipped" op50>
<template #header>
Skip
</template>
<template #body>
{{ skipped }}
</template>
</DashboardEntry>
<DashboardEntry v-if="todo" op50>
<template #header>
Todo
</template>
<template #body>
{{ todo }}
</template>
</DashboardEntry>
<DashboardEntry :tail="true">
<template #header>
Total
</template>
<template #body>
{{ total }}
</template>
</DashboardEntry>
</div>
</template>