@autoafleveren/ui 1.4.6 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
const slots = useSlots();
|
|
28
28
|
|
|
29
|
+
const hasAvatar = computed(() => !!slots.avatar);
|
|
29
30
|
const hasTitle = computed(() => !!slots.title || !!props.title);
|
|
30
31
|
const hasIcon = computed(() => !!slots.icon || !!props.icon);
|
|
31
32
|
const contentClasses = computed(() => `${props.contentClasses} ${hasTitle.value ? 'mt-4' : undefined}`);
|
|
@@ -49,6 +50,15 @@
|
|
|
49
50
|
<slot name="icon"></slot>
|
|
50
51
|
</CardIconSlot>
|
|
51
52
|
|
|
53
|
+
<div
|
|
54
|
+
v-if="hasAvatar"
|
|
55
|
+
:class="{ 'mr-3': hasIcon }"
|
|
56
|
+
class="float-right"
|
|
57
|
+
data-test-avatar
|
|
58
|
+
>
|
|
59
|
+
<slot name="avatar"></slot>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
52
62
|
<h3
|
|
53
63
|
v-if="hasTitle"
|
|
54
64
|
class="text-2xl font-bold text-zinc-900"
|
|
@@ -7,6 +7,7 @@ describe('the AppCard component', () => {
|
|
|
7
7
|
it('should hide the optional elements by default', () => {
|
|
8
8
|
const wrapper = shallowMount(AppCard);
|
|
9
9
|
|
|
10
|
+
expect(wrapper.find('[data-test-avatar]').exists()).toBe(false);
|
|
10
11
|
expect(wrapper.find('[data-test-title]').exists()).toBe(false);
|
|
11
12
|
expect(wrapper.find('[data-test-icon]').exists()).toBe(false);
|
|
12
13
|
});
|
|
@@ -77,6 +78,16 @@ describe('the AppCard component', () => {
|
|
|
77
78
|
expect(descriptionElement.text()).toBe('description');
|
|
78
79
|
});
|
|
79
80
|
|
|
81
|
+
it('can set the avatar by slot', () => {
|
|
82
|
+
const wrapper = shallowMount(AppCard, {
|
|
83
|
+
slots: { avatar: 'test-avatar' },
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const avatar = wrapper.find('[data-test-avatar]');
|
|
87
|
+
expect(avatar.exists()).toBe(true);
|
|
88
|
+
expect(avatar.text()).toBe('test-avatar');
|
|
89
|
+
});
|
|
90
|
+
|
|
80
91
|
it('can set the icon by prop', () => {
|
|
81
92
|
const wrapper = shallowMount(AppCard, {
|
|
82
93
|
props: { icon: 'icon' },
|