feat: refs #8581 add data-cy attributes CardDescriptor

This commit is contained in:
Jorge Penadés 2025-02-21 13:48:09 +01:00
parent 9b0365aac4
commit a8fa03a5d0
1 changed files with 19 additions and 7 deletions

View File

@ -120,7 +120,7 @@ const toModule = computed(() =>
</script>
<template>
<div class="descriptor">
<div class="descriptor" :data-cy="$attrs['data-cy'] ?? 'cardDescriptor'">
<template v-if="entity && !isLoading">
<div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action"
@ -182,18 +182,27 @@ const toModule = computed(() =>
<QList dense>
<QItemLabel header class="ellipsis text-h5" :lines="1">
<div class="title">
<span v-if="$props.title" :title="getValueFromPath(title)">
<span
v-if="$props.title"
:title="getValueFromPath(title)"
:data-cy="`${$attrs['data-cy'] ?? 'cardDescriptor'}_title`"
>
{{ getValueFromPath(title) ?? $props.title }}
</span>
<slot v-else name="description" :entity="entity">
<span :title="entity.name">
{{ entity.name }}
</span>
<span
:title="entity.name"
:data-cy="`${$attrs['data-cy'] ?? 'cardDescriptor'}_description`"
v-text="entity.name"
/>
</slot>
</div>
</QItemLabel>
<QItem>
<QItemLabel class="subtitle">
<QItemLabel
class="subtitle"
:data-cy="`${$attrs['data-cy'] ?? 'cardDescriptor'}_subtitle`"
>
#{{ getValueFromPath(subtitle) ?? entity.id }}
</QItemLabel>
@ -213,7 +222,10 @@ const toModule = computed(() =>
<!-- </QItemLabel> -->
</QItem>
</QList>
<div class="list-box q-mt-xs">
<div
class="list-box q-mt-xs"
:data-cy="`${$attrs['data-cy'] ?? 'cardDescriptor'}_listbox`"
>
<slot name="body" :entity="entity" />
</div>
</div>