From 514d17048f79ff8ee28967acff0610fe6c75dbfd Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Fri, 12 Apr 2024 18:59:53 +0200 Subject: [PATCH] chore(Toast): update slots --- src/runtime/components/Toast.vue | 1 - test/components/Toast.spec.ts | 6 +- .../__snapshots__/Toast.spec.ts.snap | 144 ++++++++++++++++++ 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/src/runtime/components/Toast.vue b/src/runtime/components/Toast.vue index 99262315..2bb25c81 100644 --- a/src/runtime/components/Toast.vue +++ b/src/runtime/components/Toast.vue @@ -28,7 +28,6 @@ export interface ToastProps extends Omit { ['without close', { props: { title: 'Toast', close: null } }], ['with type', { props: { type: 'background' as const } }], ['with class', { props: { class: 'bg-gray-50 dark:bg-gray-800/50' } }], - ['with ui', { props: { title: 'Toast', ui: { title: 'font-bold' } } }] + ['with ui', { props: { title: 'Toast', ui: { title: 'font-bold' } } }], + ['with leading slot', { slots: { title: () => 'Leading slot' } }], + ['with title slot', { slots: { title: () => 'Title slot' } }], + ['with description slot', { slots: { description: () => 'Description slot' } }], + ['with close slot', { slots: { close: () => 'Close slot' } }] ])('renders %s correctly', async (nameOrHtml: string, options: { props?: ToastProps, slots?: any }) => { const html = await ComponentRender(nameOrHtml, options, ToastWrapper) expect(html).toMatchSnapshot() diff --git a/test/components/__snapshots__/Toast.spec.ts.snap b/test/components/__snapshots__/Toast.spec.ts.snap index 59f0284b..16a1f989 100644 --- a/test/components/__snapshots__/Toast.spec.ts.snap +++ b/test/components/__snapshots__/Toast.spec.ts.snap @@ -50,6 +50,30 @@ exports[`Toast > renders with avatar correctly 1`] = ` " `; +exports[`Toast > renders with body slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + exports[`Toast > renders with class correctly 1`] = ` " @@ -74,6 +98,30 @@ exports[`Toast > renders with class correctly 1`] = ` " `; +exports[`Toast > renders with close slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + exports[`Toast > renders with color correctly 1`] = ` " @@ -151,6 +199,54 @@ exports[`Toast > renders with description correctly 1`] = ` " `; +exports[`Toast > renders with description slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + +exports[`Toast > renders with footer slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + exports[`Toast > renders with icon correctly 1`] = ` " @@ -175,6 +271,30 @@ exports[`Toast > renders with icon correctly 1`] = ` " `; +exports[`Toast > renders with leading slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + exports[`Toast > renders with title & description correctly 1`] = ` " @@ -225,6 +345,30 @@ exports[`Toast > renders with title correctly 1`] = ` " `; +exports[`Toast > renders with title slot correctly 1`] = ` +" + + +
+
    +
  1. + +
    + + + +
    +
    +
    +
  2. +
+
" +`; + exports[`Toast > renders with type correctly 1`] = ` "