@farm-investimentos/front-mfe-components 15.14.0 → 15.14.1
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/dist/front-mfe-components.common.js +117 -112
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +117 -112
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterEmptyState/FilterEmptyState.vue +12 -9
- package/src/components/FilterEmptyState/__tests__/FilterEmptyState.test.js +25 -3
package/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<farm-box>
|
|
3
3
|
<farm-row justify="center" class="mb-4">
|
|
4
4
|
<img
|
|
5
|
-
v-if="
|
|
6
|
-
:src="
|
|
7
|
-
:alt="
|
|
5
|
+
v-if="isNotFound"
|
|
6
|
+
:src="isNotFoundImage"
|
|
7
|
+
:alt="isNotFoundImageAlt"
|
|
8
8
|
class="filter-empty-state__image"
|
|
9
9
|
/>
|
|
10
10
|
<img
|
|
11
|
-
v-else
|
|
12
|
-
:src="
|
|
13
|
-
:alt="
|
|
11
|
+
v-else
|
|
12
|
+
:src="isEmptyImage"
|
|
13
|
+
:alt="isEmptyImageAlt"
|
|
14
14
|
class="filter-empty-state__image"
|
|
15
15
|
/>
|
|
16
16
|
</farm-row>
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
<script lang="ts">
|
|
35
35
|
import { defineComponent, PropType } from 'vue';
|
|
36
36
|
|
|
37
|
+
const emptyDataImage: string = require('../../assets/imgs/empty-data.svg');
|
|
38
|
+
const emptyNotFoundImage: string = require('../../assets/imgs/empty-not-found.svg');
|
|
39
|
+
|
|
37
40
|
export type FilterEmptyStateProps = {
|
|
38
41
|
/**
|
|
39
42
|
* Indicates if the state is empty (no data)
|
|
@@ -77,7 +80,7 @@ export default defineComponent({
|
|
|
77
80
|
*/
|
|
78
81
|
isEmpty: {
|
|
79
82
|
type: Boolean as PropType<FilterEmptyStateProps['isEmpty']>,
|
|
80
|
-
default:
|
|
83
|
+
default: true,
|
|
81
84
|
},
|
|
82
85
|
/**
|
|
83
86
|
* Indicates if the state is not found (no results from filter)
|
|
@@ -91,7 +94,7 @@ export default defineComponent({
|
|
|
91
94
|
*/
|
|
92
95
|
isEmptyImage: {
|
|
93
96
|
type: String as PropType<FilterEmptyStateProps['isEmptyImage']>,
|
|
94
|
-
default:
|
|
97
|
+
default: emptyDataImage,
|
|
95
98
|
},
|
|
96
99
|
/**
|
|
97
100
|
* Alt text for empty state image
|
|
@@ -105,7 +108,7 @@ export default defineComponent({
|
|
|
105
108
|
*/
|
|
106
109
|
isNotFoundImage: {
|
|
107
110
|
type: String as PropType<FilterEmptyStateProps['isNotFoundImage']>,
|
|
108
|
-
default:
|
|
111
|
+
default: emptyNotFoundImage,
|
|
109
112
|
},
|
|
110
113
|
/**
|
|
111
114
|
* Alt text for not found state image
|
|
@@ -88,13 +88,21 @@ describe('FilterEmptyState', () => {
|
|
|
88
88
|
stubs: globalStubs,
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
expect(wrapper.props('isEmpty')).toBe(
|
|
91
|
+
expect(wrapper.props('isEmpty')).toBe(true);
|
|
92
92
|
expect(wrapper.props('isNotFound')).toBe(false);
|
|
93
93
|
expect(wrapper.props('title')).toBe('');
|
|
94
94
|
expect(wrapper.props('subtitle')).toBe('');
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
it('
|
|
97
|
+
it('shows empty image by default when no props are provided', () => {
|
|
98
|
+
const wrapper = mount(FilterEmptyState, {
|
|
99
|
+
stubs: globalStubs,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('shows empty image when isEmpty is false and isNotFound is false', () => {
|
|
98
106
|
const wrapper = mount(FilterEmptyState, {
|
|
99
107
|
propsData: {
|
|
100
108
|
isEmpty: false,
|
|
@@ -103,6 +111,20 @@ describe('FilterEmptyState', () => {
|
|
|
103
111
|
stubs: globalStubs,
|
|
104
112
|
});
|
|
105
113
|
|
|
106
|
-
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(
|
|
114
|
+
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('prioritizes isNotFound over isEmpty', () => {
|
|
118
|
+
const wrapper = mount(FilterEmptyState, {
|
|
119
|
+
propsData: {
|
|
120
|
+
isEmpty: true,
|
|
121
|
+
isNotFound: true,
|
|
122
|
+
},
|
|
123
|
+
stubs: globalStubs,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const img = wrapper.find('.filter-empty-state__image');
|
|
127
|
+
expect(img.exists()).toBe(true);
|
|
128
|
+
expect(img.attributes('alt')).toBe('Imagem referente a filtro vazio');
|
|
107
129
|
});
|
|
108
130
|
});
|