@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "15.14.0",
3
+ "version": "15.14.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -2,15 +2,15 @@
2
2
  <farm-box>
3
3
  <farm-row justify="center" class="mb-4">
4
4
  <img
5
- v-if="isEmpty"
6
- :src="isEmptyImage"
7
- :alt="isEmptyImageAlt"
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-if="isNotFound"
12
- :src="isNotFoundImage"
13
- :alt="isNotFoundImageAlt"
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: false,
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: require('../../assets/imgs/empty-data.svg'),
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: require('../../assets/imgs/empty-not-found.svg'),
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(false);
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('does not show image when neither isEmpty nor isNotFound is true', () => {
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(false);
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
  });