diff --git a/src/components/FileCard.spec.ts b/src/components/FileCard.spec.ts index 9f74c91..105c894 100644 --- a/src/components/FileCard.spec.ts +++ b/src/components/FileCard.spec.ts @@ -36,4 +36,12 @@ describe('FileCard', () => { const withSubname = mount(FileCard, { slots: { subname: 'a subname' } }) expect(withSubname.find('.file-card__subname').text()).toBe('a subname') }) + + it('only renders the overlay slot when provided', () => { + const without = mount(FileCard) + expect(without.find('.file-card__overlay').exists()).toBe(false) + + const withOverlay = mount(FileCard, { slots: { overlay: 'a badge' } }) + expect(withOverlay.find('.file-card__overlay').text()).toBe('a badge') + }) }) diff --git a/src/components/FileCard.vue b/src/components/FileCard.vue index 744c60b..78aeeab 100644 --- a/src/components/FileCard.vue +++ b/src/components/FileCard.vue @@ -11,6 +11,9 @@ defineEmits<{ click: [event: MouseEvent] }>()