@farm-investimentos/front-mfe-components 6.3.1 → 6.3.4
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 +390 -301
- 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 +390 -301
- 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 +3 -3
- package/src/components/Buttons/DefaultButton/DefaultButton.scss +18 -15
- package/src/components/Collapsible/Collapsible.scss +4 -17
- package/src/components/Collapsible/Collapsible.vue +16 -13
- package/src/components/DialogFooter/DialogFooter.scss +30 -0
- package/src/components/DialogFooter/DialogFooter.vue +14 -11
- package/src/components/DialogFooter/IExtraButton.ts +9 -0
- package/src/components/Icon/Icon.vue +24 -6
- package/src/components/Icon/__tests__/Icon.spec.js +8 -0
- package/src/components/Logger/Logger.scss +22 -14
- package/src/components/Logger/Logger.stories.js +2 -4
- package/src/components/Logger/Logger.vue +37 -3
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +2 -2
- package/src/components/Logger/LoggerItem/LoggerItem.vue +12 -10
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +3 -3
- package/src/components/Logger/__tests__/Logger.spec.js +96 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.scss +10 -8
- package/src/components/Stepper/StepperHeader/StepperHeader.stories.js +2 -4
- package/src/components/Stepper/StepperHeader/StepperHeader.vue +10 -8
- package/src/configurations/_functions.scss +5 -0
- package/src/configurations/_mixins.scss +5 -0
- package/src/configurations/_variables.scss +14 -1
- package/src/examples/Buttons.stories.js +10 -0
- package/src/examples/Icon.stories.js +6 -0
- package/src/examples/Logger/Logger.stories.js +12 -0
- package/src/examples/Stepper/StepperHeader.stories.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm-investimentos/front-mfe-components",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.4",
|
|
4
4
|
"author": "farm investimentos",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/front-mfe-components.common.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"core-js": "^3.8.3",
|
|
25
|
-
"vue": "^2.
|
|
25
|
+
"vue": "^2.7.0",
|
|
26
26
|
"vuetify": "^2.4.5",
|
|
27
27
|
"vuetify-dialog": "^2.0.17"
|
|
28
28
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"storybook-addon-designs": "^6.2.1",
|
|
51
51
|
"typescript": "~4.1.5",
|
|
52
52
|
"v-mask": "^2.3.0",
|
|
53
|
-
"vue-template-compiler": "^2.
|
|
53
|
+
"vue-template-compiler": "^2.7.0"
|
|
54
54
|
},
|
|
55
55
|
"browserslist": [
|
|
56
56
|
"> 1%",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
&:hover {
|
|
104
104
|
color: var(--v-#{$color}-base);
|
|
105
105
|
}
|
|
106
|
+
|
|
106
107
|
i.mdi {
|
|
107
108
|
color: var(--v-#{$color}-base);
|
|
108
109
|
}
|
|
@@ -132,27 +133,29 @@
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
.farm-btn--
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.farm-btn__content i.mdi {
|
|
136
|
+
:not(.farm-btn--disabled){
|
|
137
|
+
&.farm-btn--outlined#{'.farm-btn--' + $color} {
|
|
138
|
+
border: 1px solid var(--v-#{$color}-base);
|
|
139
|
+
background: white;
|
|
141
140
|
color: var(--v-#{$color}-base);
|
|
141
|
+
|
|
142
|
+
.farm-btn__content i.mdi {
|
|
143
|
+
color: var(--v-#{$color}-base);
|
|
144
|
+
}
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
border: none;
|
|
148
|
-
background: white;
|
|
149
|
-
color: var(--v-#{$color}-base);
|
|
150
|
-
|
|
151
|
-
.farm-btn__content i.mdi {
|
|
147
|
+
&.farm-btn--plain#{'.farm-btn--' + $color} {
|
|
148
|
+
border: none;
|
|
149
|
+
background: white;
|
|
152
150
|
color: var(--v-#{$color}-base);
|
|
151
|
+
|
|
152
|
+
.farm-btn__content i.mdi {
|
|
153
|
+
color: var(--v-#{$color}-base);
|
|
154
|
+
}
|
|
153
155
|
}
|
|
154
|
-
|
|
155
156
|
}
|
|
157
|
+
|
|
158
|
+
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
.farm-btn--elevated {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
&__title {
|
|
22
22
|
font-size: 1.25rem;
|
|
23
|
-
color:
|
|
23
|
+
color: var(--v-primary-base);
|
|
24
24
|
|
|
25
25
|
@media screen and (max-width: 600px) {
|
|
26
26
|
font-size: 0.9rem;
|
|
@@ -28,27 +28,13 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
&__icon {
|
|
31
|
-
|
|
32
|
-
font-size: 1.625rem;
|
|
33
|
-
}
|
|
31
|
+
|
|
34
32
|
&--main {
|
|
35
33
|
margin-right: 0.5rem;
|
|
36
|
-
i {
|
|
37
|
-
color: #00b493;
|
|
38
|
-
}
|
|
39
|
-
@media screen and (max-width: 600px) {
|
|
40
|
-
i {
|
|
41
|
-
font-size: 1.5rem;
|
|
42
|
-
color: #00b493;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
34
|
}
|
|
46
35
|
|
|
47
36
|
&--arrow {
|
|
48
37
|
margin-left: 0.5rem;
|
|
49
|
-
i {
|
|
50
|
-
color: #1c1c1c;
|
|
51
|
-
}
|
|
52
38
|
}
|
|
53
39
|
}
|
|
54
40
|
|
|
@@ -62,7 +48,8 @@
|
|
|
62
48
|
.fade-leave-active {
|
|
63
49
|
transition: opacity 0.3s ease-in-out;
|
|
64
50
|
}
|
|
51
|
+
|
|
65
52
|
.fade-enter,
|
|
66
53
|
.fade-leave-to {
|
|
67
54
|
opacity: 0;
|
|
68
|
-
}
|
|
55
|
+
}
|
|
@@ -3,25 +3,18 @@
|
|
|
3
3
|
<div class="collapsible__header" @click="onToggleCollapsible(status)">
|
|
4
4
|
<div class="collapsible__content-title">
|
|
5
5
|
<div class="collapsible__icon collapsible__icon--main" v-if="icon !== ''">
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
['mdi-' + icon]: true,
|
|
10
|
-
}"
|
|
11
|
-
></i>
|
|
6
|
+
<farm-icon color="secondary" size="1.625rem">
|
|
7
|
+
{{ icon }}
|
|
8
|
+
</farm-icon>
|
|
12
9
|
</div>
|
|
13
10
|
<h3 class="collapsible__title">
|
|
14
11
|
{{ title }}
|
|
15
12
|
</h3>
|
|
16
13
|
</div>
|
|
17
14
|
<div class="collapsible__icon collapsible__icon--arrow">
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
['mdi-menu-down']: !status,
|
|
22
|
-
['mdi-menu-up']: status,
|
|
23
|
-
}"
|
|
24
|
-
></i>
|
|
15
|
+
<farm-icon size="1.625rem" color="primary">
|
|
16
|
+
{{ arrowIcon }}
|
|
17
|
+
</farm-icon>
|
|
25
18
|
</div>
|
|
26
19
|
</div>
|
|
27
20
|
<transition name="fade">
|
|
@@ -34,8 +27,13 @@
|
|
|
34
27
|
|
|
35
28
|
<script lang="ts">
|
|
36
29
|
import Vue from 'vue';
|
|
30
|
+
import Icon from '../Icon';
|
|
37
31
|
|
|
38
32
|
export default Vue.extend({
|
|
33
|
+
name: 'farm-collapsible',
|
|
34
|
+
components: {
|
|
35
|
+
'farm-icon': Icon,
|
|
36
|
+
},
|
|
39
37
|
props: {
|
|
40
38
|
title: {
|
|
41
39
|
type: String,
|
|
@@ -55,6 +53,11 @@ export default Vue.extend({
|
|
|
55
53
|
status: this.$props.open,
|
|
56
54
|
};
|
|
57
55
|
},
|
|
56
|
+
computed: {
|
|
57
|
+
arrowIcon() {
|
|
58
|
+
return this.status ? 'menu-up' : 'menu-down';
|
|
59
|
+
},
|
|
60
|
+
},
|
|
58
61
|
methods: {
|
|
59
62
|
onToggleCollapsible(status: boolean): void {
|
|
60
63
|
this.status = !status;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import '../../configurations/functions';
|
|
2
|
+
@import '../../configurations/mixins';
|
|
3
|
+
|
|
4
|
+
.farm-dialog__footer {
|
|
5
|
+
border-top: 1px solid var(--v-gray-lighten2);
|
|
6
|
+
padding: 1rem;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: flex-end;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.farm-btn {
|
|
13
|
+
margin-left: gutter();
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@include for-sm-breakpoint {
|
|
18
|
+
.farm-btn {
|
|
19
|
+
margin-left: 0;
|
|
20
|
+
margin-top: gutter();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.farm-dialog__footer {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
|
|
26
|
+
.farm-btn:first-of-type {
|
|
27
|
+
margin-top: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<farm-btn
|
|
2
|
+
<div class="farm-dialog__footer">
|
|
3
|
+
<farm-btn v-if="hasCancel" color="primary" outlined @click="$emit('onClose')">
|
|
4
4
|
{{ closeLabel }}
|
|
5
5
|
</farm-btn>
|
|
6
6
|
<farm-btn
|
|
@@ -8,15 +8,12 @@
|
|
|
8
8
|
:key="button.label"
|
|
9
9
|
:color="button.color"
|
|
10
10
|
:outlined="button.outlined"
|
|
11
|
-
:depressed="button.outlined"
|
|
12
11
|
:disabled="button.disabled"
|
|
13
|
-
class="ml-sm-3 mt-3 mt-sm-0"
|
|
14
12
|
@click="$emit(button.listener ? button.listener : '')"
|
|
15
13
|
>
|
|
16
14
|
{{ button.label }}
|
|
17
15
|
</farm-btn>
|
|
18
16
|
<farm-btn
|
|
19
|
-
class="ml-sm-3 mt-3 mt-sm-0"
|
|
20
17
|
v-if="hasConfirm"
|
|
21
18
|
:color="confirmColor"
|
|
22
19
|
:disabled="isConfirmDisabled"
|
|
@@ -28,13 +25,16 @@
|
|
|
28
25
|
</div>
|
|
29
26
|
</template>
|
|
30
27
|
|
|
31
|
-
<script>
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import Vue, { PropType } from 'vue';
|
|
32
30
|
import DefaultButton from '../Buttons/DefaultButton';
|
|
31
|
+
import IExtraButton from './IExtraButton';
|
|
32
|
+
|
|
33
33
|
/**
|
|
34
34
|
* Footer de dialog/modal
|
|
35
35
|
*/
|
|
36
|
-
export default {
|
|
37
|
-
name: '
|
|
36
|
+
export default Vue.extend({
|
|
37
|
+
name: 'farm-dialog-foote',
|
|
38
38
|
components: {
|
|
39
39
|
'farm-btn': DefaultButton,
|
|
40
40
|
},
|
|
@@ -89,12 +89,15 @@ export default {
|
|
|
89
89
|
default: false,
|
|
90
90
|
},
|
|
91
91
|
/**
|
|
92
|
-
* lista de botões extra
|
|
92
|
+
* lista de botões extra (IExtraButton)
|
|
93
93
|
*/
|
|
94
94
|
extraButtons: {
|
|
95
|
-
type: Array
|
|
95
|
+
type: Array as PropType<Array<IExtraButton>>,
|
|
96
96
|
default: () => [],
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
|
-
};
|
|
99
|
+
});
|
|
100
100
|
</script>
|
|
101
|
+
<style lang="scss" scoped>
|
|
102
|
+
@import 'DialogFooter';
|
|
103
|
+
</style>
|
|
@@ -37,6 +37,12 @@ export default Vue.extend({
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
icon: '',
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
|
|
40
46
|
computed: {
|
|
41
47
|
classes() {
|
|
42
48
|
const obj = {};
|
|
@@ -48,18 +54,30 @@ export default Vue.extend({
|
|
|
48
54
|
...obj,
|
|
49
55
|
};
|
|
50
56
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return '';
|
|
54
|
-
}
|
|
55
|
-
return this.$slots.default[0].text!.trim();
|
|
57
|
+
fontSize() {
|
|
58
|
+
return isNaN(this.size) ? this.size : `${this.size}px`;
|
|
56
59
|
},
|
|
57
60
|
},
|
|
58
61
|
mounted() {
|
|
59
62
|
if (this.size !== 'default' && !breakPoints.includes(this.size)) {
|
|
60
|
-
this.$el.style.fontSize = this.
|
|
63
|
+
this.$el.style.fontSize = this.fontSize;
|
|
61
64
|
}
|
|
62
65
|
},
|
|
66
|
+
created() {
|
|
67
|
+
this.checkForSlotContent();
|
|
68
|
+
},
|
|
69
|
+
beforeUpdate() {
|
|
70
|
+
this.checkForSlotContent();
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
checkForSlotContent() {
|
|
74
|
+
if (!this.$slots.default) {
|
|
75
|
+
this.icon = '';
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.icon = this.$slots.default[0].text!.trim();
|
|
79
|
+
},
|
|
80
|
+
},
|
|
63
81
|
});
|
|
64
82
|
</script>
|
|
65
83
|
<style lang="scss" scoped>
|
|
@@ -18,5 +18,13 @@ describe('Icon component', () => {
|
|
|
18
18
|
it('get classes', () => {
|
|
19
19
|
expect(component.classes).toBeDefined();
|
|
20
20
|
});
|
|
21
|
+
|
|
22
|
+
it('get icon', () => {
|
|
23
|
+
expect(component.icon).toEqual('');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('get fontSize', () => {
|
|
27
|
+
expect(component.fontSize).toEqual('default');
|
|
28
|
+
});
|
|
21
29
|
});
|
|
22
30
|
});
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
.logger {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.logger__item {
|
|
5
|
-
float: left;
|
|
6
|
-
clear: both;
|
|
7
|
-
}
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
8
4
|
}
|
|
9
|
-
|
|
10
5
|
.logger__divider {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
6
|
+
height: 40px;
|
|
7
|
+
margin: -4px 0 -4px 16px;
|
|
8
|
+
width: 1px;
|
|
9
|
+
|
|
10
|
+
&.logger__divider--success {
|
|
11
|
+
background: var(--v-secondary-base);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.logger__divider--error {
|
|
15
|
+
background: var(--v-error-base);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.logger__divider--error-to-success {
|
|
19
|
+
background: linear-gradient(to bottom, var(--v-error-base), var(--v-secondary-base));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.logger__divider--success-to-error {
|
|
23
|
+
background: linear-gradient(to bottom, var(--v-secondary-base), var(--v-error-base));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -21,13 +21,11 @@ export default {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const Primary = () => ({
|
|
24
|
-
components: { Logger },
|
|
24
|
+
components: { 'farm-logger': Logger },
|
|
25
25
|
data() {
|
|
26
26
|
return {};
|
|
27
27
|
},
|
|
28
|
-
template: `<
|
|
29
|
-
|
|
30
|
-
</Logger>`,
|
|
28
|
+
template: `<farm-logger />`,
|
|
31
29
|
});
|
|
32
30
|
|
|
33
31
|
Primary.storyName = 'Básico';
|
|
@@ -2,8 +2,19 @@
|
|
|
2
2
|
<section class="logger">
|
|
3
3
|
<template v-for="(item, index) in items">
|
|
4
4
|
<LoggerItem :item="item" :key="index" />
|
|
5
|
-
<div
|
|
6
|
-
|
|
5
|
+
<div
|
|
6
|
+
:class="{
|
|
7
|
+
'logger__divider--success': isPreviousLogAndCurrentLogSuccess(index),
|
|
8
|
+
'logger__divider--error': isPreviousLogAndCurrentLogError(index),
|
|
9
|
+
'logger__divider--success-to-error':
|
|
10
|
+
isPreviousLogErrorAndCurrentLogSuccess(index),
|
|
11
|
+
'logger__divider--error-to-success':
|
|
12
|
+
isPreviousLogSuccessAndCurrentLogError(index),
|
|
13
|
+
}"
|
|
14
|
+
v-if="hasDivider(index)"
|
|
15
|
+
class="logger__divider"
|
|
16
|
+
:key="'divider_' + index"
|
|
17
|
+
></div>
|
|
7
18
|
</template>
|
|
8
19
|
</section>
|
|
9
20
|
</template>
|
|
@@ -15,11 +26,34 @@ import LoggerItem from './LoggerItem/';
|
|
|
15
26
|
export default Vue.extend({
|
|
16
27
|
name: 'farm-logger',
|
|
17
28
|
components: { LoggerItem },
|
|
18
|
-
props: {
|
|
29
|
+
props: {
|
|
30
|
+
/*
|
|
31
|
+
* List of logger items
|
|
32
|
+
*/
|
|
33
|
+
items: { required: true, type: Array as PropType<Array<ILoggerItem>> },
|
|
34
|
+
},
|
|
19
35
|
methods: {
|
|
20
36
|
hasDivider(index: number): boolean {
|
|
21
37
|
return index < this.items.length - 1;
|
|
22
38
|
},
|
|
39
|
+
isPreviousLogAndCurrentLogError(index: number): boolean {
|
|
40
|
+
return this.isError(index) && this.isError(index + 1);
|
|
41
|
+
},
|
|
42
|
+
isPreviousLogAndCurrentLogSuccess(index: number): boolean {
|
|
43
|
+
return this.isSuccess(index) && this.isSuccess(index + 1);
|
|
44
|
+
},
|
|
45
|
+
isPreviousLogErrorAndCurrentLogSuccess(index: number): boolean {
|
|
46
|
+
return this.isSuccess(index) && this.isError(index + 1);
|
|
47
|
+
},
|
|
48
|
+
isPreviousLogSuccessAndCurrentLogError(index: number): boolean {
|
|
49
|
+
return this.isError(index) && this.isSuccess(index + 1);
|
|
50
|
+
},
|
|
51
|
+
isError(index: number): boolean {
|
|
52
|
+
return this.items[index].status === 'error';
|
|
53
|
+
},
|
|
54
|
+
isSuccess(index: number): boolean {
|
|
55
|
+
return this.items[index].status === 'success';
|
|
56
|
+
},
|
|
23
57
|
},
|
|
24
58
|
});
|
|
25
59
|
</script>
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const Primary = () => ({
|
|
23
|
-
components: { LoggerItem },
|
|
23
|
+
components: { 'farm-logger-item': LoggerItem },
|
|
24
24
|
data() {
|
|
25
25
|
return {
|
|
26
26
|
item: {
|
|
@@ -32,7 +32,7 @@ export const Primary = () => ({
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
|
-
template: `<
|
|
35
|
+
template: `<farm-logger-item :item="item" />`,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
Primary.storyName = 'Básico';
|
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
'logger__item--success': item.status === 'success',
|
|
7
7
|
}"
|
|
8
8
|
>
|
|
9
|
-
<
|
|
10
|
-
:class="{
|
|
11
|
-
mdi: true,
|
|
12
|
-
[mdiIconName]: true,
|
|
13
|
-
}"
|
|
14
|
-
/>
|
|
9
|
+
<farm-icon>{{ mdiIconName }}</farm-icon>
|
|
15
10
|
<div>
|
|
16
11
|
<span class="logger__date">
|
|
17
12
|
{{ item.formattedDate }}
|
|
@@ -29,25 +24,32 @@
|
|
|
29
24
|
<script lang="ts">
|
|
30
25
|
import Vue, { PropType } from 'vue';
|
|
31
26
|
import ILoggerItem from './ILoggerItem';
|
|
27
|
+
import Icon from '../../Icon';
|
|
32
28
|
|
|
33
29
|
export default Vue.extend({
|
|
34
30
|
name: 'farm-logger-item',
|
|
31
|
+
components: {
|
|
32
|
+
'farm-icon': Icon,
|
|
33
|
+
},
|
|
35
34
|
props: {
|
|
35
|
+
/**
|
|
36
|
+
* Logger item
|
|
37
|
+
*/
|
|
36
38
|
item: { required: true, type: Object as PropType<ILoggerItem> },
|
|
37
39
|
},
|
|
38
40
|
computed: {
|
|
39
41
|
mdiIconName() {
|
|
40
42
|
if (this.item.icon) {
|
|
41
|
-
return
|
|
43
|
+
return `${this.item.icon}`;
|
|
42
44
|
}
|
|
43
|
-
if(!this.item.status) {
|
|
45
|
+
if (!this.item.status) {
|
|
44
46
|
return '';
|
|
45
47
|
}
|
|
46
|
-
return
|
|
48
|
+
return `${this.item.status === 'success' ? 'check' : 'close'}`;
|
|
47
49
|
},
|
|
48
50
|
},
|
|
49
51
|
});
|
|
50
52
|
</script>
|
|
51
|
-
<style lang="
|
|
53
|
+
<style lang="scss" scoped>
|
|
52
54
|
@import './LoggerItem.scss'
|
|
53
55
|
</style>
|
|
@@ -28,7 +28,7 @@ describe('LoggerItem component', () => {
|
|
|
28
28
|
icon: 'aaa',
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
|
-
expect(component.mdiIconName).toEqual('
|
|
31
|
+
expect(component.mdiIconName).toEqual('aaa');
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('Should return success icon', async () => {
|
|
@@ -37,7 +37,7 @@ describe('LoggerItem component', () => {
|
|
|
37
37
|
status: 'success',
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
-
expect(component.mdiIconName).toEqual('
|
|
40
|
+
expect(component.mdiIconName).toEqual('check');
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it('Should return success icon', async () => {
|
|
@@ -46,7 +46,7 @@ describe('LoggerItem component', () => {
|
|
|
46
46
|
status: 'error',
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
|
-
expect(component.mdiIconName).toEqual('
|
|
49
|
+
expect(component.mdiIconName).toEqual('close');
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
});
|
|
@@ -3,6 +3,7 @@ import Logger from '../Logger';
|
|
|
3
3
|
|
|
4
4
|
describe('Logger component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
+
let component;
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
wrapper = shallowMount(Logger, {
|
|
@@ -15,12 +16,107 @@ describe('Logger component', () => {
|
|
|
15
16
|
formattedDate: '13/06/2022 20:40',
|
|
16
17
|
status: 'error',
|
|
17
18
|
},
|
|
19
|
+
{
|
|
20
|
+
icon: 'book',
|
|
21
|
+
message: 'Recusado entre as pré elegíveis',
|
|
22
|
+
userName: 'Cleyton Rasta',
|
|
23
|
+
formattedDate: '13/06/2022 20:40',
|
|
24
|
+
status: 'error',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
icon: 'book',
|
|
28
|
+
message: 'Aceito entre as pré elegíveis',
|
|
29
|
+
userName: 'Cleyton Rasta',
|
|
30
|
+
formattedDate: '13/06/2022 20:40',
|
|
31
|
+
status: 'success',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
icon: 'book',
|
|
35
|
+
message: 'Aceito entre as pré elegíveis',
|
|
36
|
+
userName: 'Cleyton Rasta',
|
|
37
|
+
formattedDate: '13/06/2022 20:40',
|
|
38
|
+
status: 'success',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
icon: 'book',
|
|
42
|
+
message: 'Recusado entre as pré elegíveis',
|
|
43
|
+
userName: 'Cleyton Rasta',
|
|
44
|
+
formattedDate: '13/06/2022 20:40',
|
|
45
|
+
status: 'error',
|
|
46
|
+
},
|
|
18
47
|
],
|
|
19
48
|
},
|
|
20
49
|
});
|
|
50
|
+
component = wrapper.vm;
|
|
21
51
|
});
|
|
22
52
|
|
|
23
53
|
test('Logger created', () => {
|
|
24
54
|
expect(wrapper).toBeDefined();
|
|
25
55
|
});
|
|
56
|
+
|
|
57
|
+
describe('Methods', () => {
|
|
58
|
+
describe('hasDivider', () => {
|
|
59
|
+
it('should return true when it has a next item', () => {
|
|
60
|
+
expect(component.hasDivider(0)).toBeTruthy();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should return false when it has not a next item', () => {
|
|
64
|
+
expect(component.hasDivider(4)).toBeFalsy();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe('isPreviousLogAndCurrentLogError', () => {
|
|
69
|
+
it('should return true', () => {
|
|
70
|
+
expect(component.isPreviousLogAndCurrentLogError(0)).toBeTruthy();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should return false', () => {
|
|
74
|
+
expect(component.isPreviousLogAndCurrentLogError(1)).toBeFalsy();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('isPreviousLogAndCurrentLogSuccess', () => {
|
|
79
|
+
it('should return true', () => {
|
|
80
|
+
expect(component.isPreviousLogAndCurrentLogSuccess(2)).toBeTruthy();
|
|
81
|
+
});
|
|
82
|
+
it('should return false', () => {
|
|
83
|
+
expect(component.isPreviousLogAndCurrentLogSuccess(0)).toBeFalsy();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('isPreviousLogErrorAndCurrentLogSuccess', () => {
|
|
88
|
+
it('should return true', () => {
|
|
89
|
+
expect(component.isPreviousLogErrorAndCurrentLogSuccess(3)).toBeTruthy();
|
|
90
|
+
});
|
|
91
|
+
it('should return false', () => {
|
|
92
|
+
expect(component.isPreviousLogErrorAndCurrentLogSuccess(2)).toBeFalsy();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe('isPreviousLogSuccessAndCurrentLogError', () => {
|
|
96
|
+
it('should return true', () => {
|
|
97
|
+
expect(component.isPreviousLogSuccessAndCurrentLogError(1)).toBeTruthy();
|
|
98
|
+
});
|
|
99
|
+
it('should false', () => {
|
|
100
|
+
expect(component.isPreviousLogSuccessAndCurrentLogError(2)).toBeFalsy();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('isError', () => {
|
|
105
|
+
it('should true when the status is error', () => {
|
|
106
|
+
expect(component.isError(1)).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
it('should false when the status is success', () => {
|
|
109
|
+
expect(component.isError(2)).toBeFalsy();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
describe('isSuccess', () => {
|
|
114
|
+
it('should return true when the status is success', () => {
|
|
115
|
+
expect(component.isSuccess(2)).toBeTruthy();
|
|
116
|
+
});
|
|
117
|
+
it('should false when the status is error', () => {
|
|
118
|
+
expect(component.isSuccess(1)).toBeFalsy();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
26
122
|
});
|