From 7ae7859b4801f899c773643ea390f41873cad63e Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:19:03 +0300 Subject: [PATCH] adds preserveFooter and belowTitle slots --- lib/KCard/__tests__/KCard.spec.js | 37 +------------------------------ lib/KCard/index.vue | 30 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 41 deletions(-) diff --git a/lib/KCard/__tests__/KCard.spec.js b/lib/KCard/__tests__/KCard.spec.js index 3d1313530..a9885983d 100644 --- a/lib/KCard/__tests__/KCard.spec.js +++ b/lib/KCard/__tests__/KCard.spec.js @@ -128,7 +128,7 @@ describe('KCard', () => { expect(footerSlot.text()).toBe('footer slot content goes here'); }); }); - describe('it renders aboveTitle slot whether should occupy the area designated for it or not ', () => { + describe('it renders aboveTitle slot to occupy the area designated for it or not ', () => { it('preserves above-title space when preserveAboveTitle is true', () => { const wrapper = makeWrapper({ propsData: { @@ -178,40 +178,5 @@ describe('KCard', () => { expect(aboveTitle.exists()).toBe(true); expect(aboveTitle.text()).toBe('Above Title Content'); }); - it('adds correct margin to title when above-title is not preserved', async () => { - const wrapper = makeWrapper({ - propsData: { - to: { path: '/some-link' }, - title: 'sample title ', - headingLevel: 4, - preserveAboveTitle: false, - }, - slots: {}, - }); - // We need to wait for the next tick to ensure all reactive updates have been applied - await wrapper.vm.$nextTick(); - const heading = wrapper.find('.base-card-title'); - expect(heading.element.style.marginTop).toBe('24px'); - }); - // it('works correctly with different layouts', () => { - // const layouts = ['vertical', 'horizontal'] - // const thumbnailDisplays = ['none', 'small', 'large'] - // layouts.forEach(layout => { - // thumbnailDisplays.forEach(thumbnailDisplay => { - // const wrapper = makeWrapper( { - // propsData: { to: { path: '/some-link' },title: 'sample title ', headingLevel: 4 , - // layout, - // thumbnailDisplay, - // preserveAboveTitle: false, - // }, - // }) - // const aboveTitle = wrapper.find('[data-test="aboveTitle"]') - // expect(aboveTitle.exists()).toBe(false) - // // Check that the correct layout class is applied - // expect(wrapper.classes()).toContain(`${layout}-with-${thumbnailDisplay}-thumbnail`) - // }) - // }) - // } - // ) }); }); diff --git a/lib/KCard/index.vue b/lib/KCard/index.vue index 39b744a18..4b62da485 100644 --- a/lib/KCard/index.vue +++ b/lib/KCard/index.vue @@ -8,6 +8,8 @@ :class="['k-card', rootClass]" :headingStyles="headingStyles" :preserveAboveTitle="preserveAboveTitle" + :preserveBelowTitle="preserveBelowTitle" + :preserveFooter="preserveFooter" >