Skip to content

Commit

Permalink
fix(FormField): missing conditions to apply container classes (#2631)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Canac <[email protected]>
  • Loading branch information
Akryum and benjamincanac authored Nov 13, 2024
1 parent 3396d5c commit 9241ba1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/runtime/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ provide(formFieldInjectionKey, computed(() => ({
</p>
</div>

<div :class="[label && ui.container({ class: props.ui?.container })]">
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
<slot :error="error" />

<p v-if="(typeof error === 'string' && error) || !!slots.error" :class="ui.error({ class: props.ui?.error })">
Expand Down
4 changes: 2 additions & 2 deletions test/components/__snapshots__/FormField-vue.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`FormField > renders with description slot correctly 1`] = `
<!--v-if-->
<p class="text-[var(--ui-text-muted)]">Description slot</p>
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
Expand Down Expand Up @@ -130,7 +130,7 @@ exports[`FormField > renders with label slot correctly 1`] = `
</div>
<!--v-if-->
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
Expand Down
4 changes: 2 additions & 2 deletions test/components/__snapshots__/FormField.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`FormField > renders with description slot correctly 1`] = `
<!--v-if-->
<p class="text-[var(--ui-text-muted)]">Description slot</p>
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
Expand Down Expand Up @@ -130,7 +130,7 @@ exports[`FormField > renders with label slot correctly 1`] = `
</div>
<!--v-if-->
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
Expand Down

0 comments on commit 9241ba1

Please sign in to comment.