@farm-investimentos/front-mfe-components 2.4.1 → 2.4.2

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": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -21,7 +21,7 @@ export const Primary = () => ({
21
21
  sortable: true,
22
22
  value: 'approvedAmount',
23
23
  align: 'center',
24
- width: 160,
24
+ width: 320,
25
25
  },
26
26
  {
27
27
  text: 'Disponível',
@@ -12,6 +12,7 @@
12
12
  v-bind:style="{
13
13
  textAlign: item.align ? item.align : '',
14
14
  width: thWidth(item),
15
+ minWidth: thWidth(item),
15
16
  }"
16
17
  @click="item.sortable ? clickSort(item.value, $index) : ''"
17
18
  @mouseover="changeShow($index)"
@@ -8,7 +8,23 @@ describe('DataTableHeader component', () => {
8
8
  beforeEach(() => {
9
9
  wrapper = shallowMount(DataTableHeader, {
10
10
  propsData: {
11
- headers: [],
11
+ headers: [
12
+ {
13
+ value: 'A',
14
+ },
15
+ ],
16
+ sortClick: [
17
+ {
18
+ clicked: true,
19
+ show: true,
20
+ },
21
+ {
22
+ clicked: false,
23
+ show: false,
24
+ },
25
+ ],
26
+ selectedIndex: 0,
27
+ firstSelected: true,
12
28
  },
13
29
  });
14
30
  component = wrapper.vm;
@@ -35,5 +51,39 @@ describe('DataTableHeader component', () => {
35
51
  expect(component.thWidth({ width: 24 })).toEqual('24px');
36
52
  expect(component.thWidth({})).toEqual('auto');
37
53
  });
54
+
55
+ it('Should remove clicked', () => {
56
+ component.removeClicked();
57
+ expect(component.sortClick[0].clicked).toBeFalsy();
58
+ expect(component.sortClick[0].show).toBeFalsy();
59
+ });
60
+
61
+ it('Should check first selected', () => {
62
+ expect(component.checkFirstSelected(999)).toBeFalsy();
63
+ expect(component.checkFirstSelected(0)).toBeTruthy();
64
+ });
65
+
66
+ it('Should emit event when clickSort', () => {
67
+ component.clickSort('A', 0);
68
+ expect(wrapper.emitted().onClickSort).toBeDefined();
69
+ });
70
+
71
+ it('Should get type sort', () => {
72
+ expect(component.getTypeSort(false)).toEqual('ASC');
73
+ expect(component.getTypeSort(true)).toEqual('DESC');
74
+ });
75
+
76
+ it('Should change show', async () => {
77
+ component.changeShow(0);
78
+ await new Promise(r => setTimeout(r, 20));
79
+ expect(component.sortClick[0].show).toBeTruthy();
80
+ });
81
+
82
+ it('Should change show', async () => {
83
+ component.changeHidden(0);
84
+ component.changeHidden(1);
85
+ await new Promise(r => setTimeout(r, 30));
86
+ expect(component.sortClick[1].show).toBeFalsy();
87
+ });
38
88
  });
39
89
  });