@farm-investimentos/front-mfe-components 2.5.0 → 3.0.0
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 +95 -113
- 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 +95 -113
- 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/Buttons/ImportButton/__tests__/ImportButton.spec.js +7 -0
- package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +7 -0
- package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +7 -0
- package/src/components/CardContext/CardContext.scss +1 -1
- package/src/components/CardContext/CardContext.vue +8 -14
- package/src/components/CardContext/__tests__/CardContext.spec.js +37 -0
- package/src/components/ResetTableRowSelection/ResetTableRowSelection.vue +9 -20
- package/src/components/ResetTableRowSelection/__tests__/ResetTableRowSelection.spec.js +2 -3
package/package.json
CHANGED
|
@@ -13,4 +13,11 @@ describe('ImportButton component', () => {
|
|
|
13
13
|
test('Created hook', () => {
|
|
14
14
|
expect(wrapper).toBeDefined();
|
|
15
15
|
});
|
|
16
|
+
|
|
17
|
+
describe('Methods', () => {
|
|
18
|
+
it('Should emit event', () => {
|
|
19
|
+
component.onClick();
|
|
20
|
+
expect(wrapper.emitted().onClick).toBeDefined();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
16
23
|
});
|
|
@@ -13,4 +13,11 @@ describe('RemoveButton component', () => {
|
|
|
13
13
|
test('Created hook', () => {
|
|
14
14
|
expect(wrapper).toBeDefined();
|
|
15
15
|
});
|
|
16
|
+
|
|
17
|
+
describe('Methods', () => {
|
|
18
|
+
it('Should emit event', () => {
|
|
19
|
+
component.onClick();
|
|
20
|
+
expect(wrapper.emitted().onClick).toBeDefined();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
16
23
|
});
|
|
@@ -11,4 +11,11 @@ describe('ToggleButton component', () => {
|
|
|
11
11
|
test('Created hook', () => {
|
|
12
12
|
expect(wrapper).toBeDefined();
|
|
13
13
|
});
|
|
14
|
+
|
|
15
|
+
describe('Methods', () => {
|
|
16
|
+
it('Should handle click', () => {
|
|
17
|
+
wrapper.vm.onClick();
|
|
18
|
+
expect(wrapper.vm.open).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
14
21
|
});
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
<div class="card-context-body" v-if="isSuccess">
|
|
12
12
|
<slot></slot>
|
|
13
13
|
</div>
|
|
14
|
-
<div class="card-context-
|
|
14
|
+
<div class="card-context-loading-or-error" v-if="isLoading">
|
|
15
15
|
<Loader :size="isLargeLoading" />
|
|
16
16
|
</div>
|
|
17
|
-
<div class="card-context-
|
|
17
|
+
<div class="card-context-loading-or-error" v-if="isError">
|
|
18
18
|
<AlertReload :label="errorLabel" @onClick="$emit('onLoad')" />
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
@@ -79,6 +79,9 @@ export default Vue.extend({
|
|
|
79
79
|
type: String,
|
|
80
80
|
default: 'Ocorreu um erro',
|
|
81
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Is full
|
|
84
|
+
*/
|
|
82
85
|
full: {
|
|
83
86
|
type: Boolean,
|
|
84
87
|
default: false,
|
|
@@ -86,25 +89,16 @@ export default Vue.extend({
|
|
|
86
89
|
},
|
|
87
90
|
computed: {
|
|
88
91
|
isBold() {
|
|
89
|
-
|
|
90
|
-
return 'card-context-title bold';
|
|
91
|
-
}
|
|
92
|
-
return 'card-context-title';
|
|
92
|
+
return this.bold ? 'card-context-title bold' : 'card-context-title';
|
|
93
93
|
},
|
|
94
94
|
isHeightFull() {
|
|
95
|
-
|
|
96
|
-
return 'card-context height-full';
|
|
97
|
-
}
|
|
98
|
-
return 'card-context';
|
|
95
|
+
return this.full ? 'card-context height-full' : 'card-context';
|
|
99
96
|
},
|
|
100
97
|
isSuccess() {
|
|
101
98
|
return !this.isLoading && !this.isError;
|
|
102
99
|
},
|
|
103
100
|
isLargeLoading() {
|
|
104
|
-
|
|
105
|
-
return 'normal';
|
|
106
|
-
}
|
|
107
|
-
return 'small';
|
|
101
|
+
return this.largeLoading ? 'normal' : 'small';
|
|
108
102
|
},
|
|
109
103
|
},
|
|
110
104
|
});
|
|
@@ -3,9 +3,11 @@ import CardContext from '../CardContext';
|
|
|
3
3
|
|
|
4
4
|
describe('CardContext component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
+
let component;
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
wrapper = shallowMount(CardContext);
|
|
10
|
+
component = wrapper.vm;
|
|
9
11
|
});
|
|
10
12
|
|
|
11
13
|
test('Created hook', () => {
|
|
@@ -17,4 +19,39 @@ describe('CardContext component', () => {
|
|
|
17
19
|
expect(wrapper.element).toMatchSnapshot();
|
|
18
20
|
});
|
|
19
21
|
});
|
|
22
|
+
|
|
23
|
+
describe('Computed properties', () => {
|
|
24
|
+
it('Should compute isBold for false', () => {
|
|
25
|
+
expect(component.isBold).toEqual('card-context-title');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('Should compute isBold for true', async () => {
|
|
29
|
+
await wrapper.setProps({
|
|
30
|
+
bold: true,
|
|
31
|
+
});
|
|
32
|
+
expect(component.isBold).toEqual('card-context-title bold');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('Should compute isHeightFull for false', () => {
|
|
36
|
+
expect(component.isHeightFull).toEqual('card-context');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('Should compute isHeightFull for true', async () => {
|
|
40
|
+
await wrapper.setProps({
|
|
41
|
+
full: true,
|
|
42
|
+
});
|
|
43
|
+
expect(component.isHeightFull).toEqual('card-context height-full');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('Should compute isLargeLoading for false', () => {
|
|
47
|
+
expect(component.isLargeLoading).toEqual('small');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('Should compute isLargeLoading for true', async () => {
|
|
51
|
+
await wrapper.setProps({
|
|
52
|
+
largeLoading: true,
|
|
53
|
+
});
|
|
54
|
+
expect(component.isLargeLoading).toEqual('normal');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
20
57
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ml-6 mr-3 d-flex align-center">
|
|
3
|
-
Total de linhas selecionadas: {{
|
|
4
|
-
<v-btn color="error" @click="reset" small dense class="ml-3" v-if="
|
|
3
|
+
Total de linhas selecionadas: {{ length }}
|
|
4
|
+
<v-btn color="error" @click="reset" small dense class="ml-3" v-if="length > 0">
|
|
5
5
|
<v-icon small> mdi-trash-can </v-icon>
|
|
6
|
-
|
|
6
|
+
Desmarcar
|
|
7
7
|
</v-btn>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
@@ -12,34 +12,23 @@ import Vue from 'vue';
|
|
|
12
12
|
import VBtn from 'vuetify/lib/components/VBtn';
|
|
13
13
|
import VIcon from 'vuetify/lib/components/VIcon';
|
|
14
14
|
export default Vue.extend({
|
|
15
|
-
name: 'farm-tablerowselection',
|
|
15
|
+
// name: 'farm-tablerowselection',
|
|
16
16
|
components: {
|
|
17
17
|
VBtn,
|
|
18
18
|
VIcon,
|
|
19
19
|
},
|
|
20
20
|
props: {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* contém a lista selecionada
|
|
22
|
+
* Current items length selected
|
|
24
23
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type:
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
computed: {
|
|
31
|
-
inputVal: {
|
|
32
|
-
get() {
|
|
33
|
-
return this.value;
|
|
34
|
-
},
|
|
35
|
-
set(val) {
|
|
36
|
-
this.$emit('input', val);
|
|
37
|
-
},
|
|
24
|
+
length: {
|
|
25
|
+
default: 0,
|
|
26
|
+
type: Number,
|
|
38
27
|
},
|
|
39
28
|
},
|
|
40
29
|
methods: {
|
|
41
30
|
reset() {
|
|
42
|
-
this
|
|
31
|
+
this.$emit('onReset');
|
|
43
32
|
},
|
|
44
33
|
},
|
|
45
34
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import ResetTableRowSelection from '../ResetTableRowSelection';
|
|
3
|
-
const items = [1, 2, 3];
|
|
4
3
|
|
|
5
4
|
describe('ResetTableRowSelection component', () => {
|
|
6
5
|
let wrapper;
|
|
@@ -9,7 +8,7 @@ describe('ResetTableRowSelection component', () => {
|
|
|
9
8
|
beforeEach(() => {
|
|
10
9
|
wrapper = shallowMount(ResetTableRowSelection, {
|
|
11
10
|
propsData: {
|
|
12
|
-
|
|
11
|
+
length: 2,
|
|
13
12
|
},
|
|
14
13
|
});
|
|
15
14
|
component = wrapper.vm;
|
|
@@ -28,7 +27,7 @@ describe('ResetTableRowSelection component', () => {
|
|
|
28
27
|
describe('methods', () => {
|
|
29
28
|
it('Should reset', () => {
|
|
30
29
|
component.reset();
|
|
31
|
-
expect(wrapper.emitted().
|
|
30
|
+
expect(wrapper.emitted().onReset).toBeDefined();
|
|
32
31
|
});
|
|
33
32
|
});
|
|
34
33
|
});
|