@farm-investimentos/front-mfe-components 2.2.5 → 2.4.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 +532 -79
- 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 +532 -79
- 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 +76 -76
- package/src/components/AlertReload/AlertReload.vue +34 -32
- package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
- package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +16 -0
- package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +16 -0
- package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +16 -0
- package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +14 -0
- package/src/components/CardContext/CardContext.scss +46 -0
- package/src/components/CardContext/CardContext.stories.js +47 -0
- package/src/components/CardContext/CardContext.vue +96 -0
- package/src/components/CardContext/__tests__/CardContext.spec.js +20 -0
- package/src/components/CardContext/index.js +3 -0
- package/src/components/DataTableHeader/DataTableHeader.vue +21 -5
- package/src/components/DialogHeader/DialogHeader.vue +9 -0
- package/src/components/IconBox/IconBox.scss +14 -0
- package/src/components/IconBox/IconBox.stories.js +13 -0
- package/src/components/IconBox/IconBox.vue +29 -0
- package/src/components/IconBox/__tests__/IconBox.spec.js +20 -0
- package/src/components/IconBox/index.js +3 -0
- package/src/components/Logos/OriginatorLogo/OriginatorLogo.stories.js +13 -0
- package/src/components/Logos/OriginatorLogo/OriginatorLogo.vue +31 -0
- package/src/components/Logos/OriginatorLogo/__tests__/OriginatorLogo.spec.js +32 -0
- package/src/components/Logos/OriginatorLogo/index.js +4 -0
- package/src/components/Logos/ProductLogo/ProductLogo.stories.js +13 -0
- package/src/components/Logos/ProductLogo/ProductLogo.vue +31 -0
- package/src/components/Logos/ProductLogo/__tests__/ProductLogo.spec.js +32 -0
- package/src/components/Logos/ProductLogo/index.js +4 -0
- package/src/components/Logos/index.js +2 -0
- package/src/components/MainFilter/__tests__/MainFilter.spec.js +23 -0
- package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
- package/src/components/Tabs/{Tabs.spec.js → __tests__/Tabs.spec.js} +1 -1
- package/src/main.js +8 -1
- package/src/components/MainFilter/MainFilter.spec.js +0 -43
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import IconBox from '../IconBox';
|
|
3
|
+
|
|
4
|
+
describe('IconBox component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(IconBox);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('mount component', () => {
|
|
16
|
+
it('renders correctly', () => {
|
|
17
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import OriginatorLogo from './OriginatorLogo.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Example/Logos/OriginatorLogo',
|
|
5
|
+
component: OriginatorLogo,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Primary = () => ({
|
|
9
|
+
components: { OriginatorLogo },
|
|
10
|
+
template: '<OriginatorLogo alt="primary" id="1" />',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
Primary.storyName = 'Básico';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img :src="imgSrc" />
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import Vue from 'vue';
|
|
6
|
+
|
|
7
|
+
export default Vue.extend({
|
|
8
|
+
name: 'farm-imglogo-originator',
|
|
9
|
+
inheritAttrs: true,
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Product id
|
|
13
|
+
*/
|
|
14
|
+
id: {
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Logo variation
|
|
19
|
+
*/
|
|
20
|
+
variation: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'full',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
imgSrc() {
|
|
27
|
+
return `/public/logos/originadores/${this.id}/${this.variation}.svg`;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import OriginatorLogo from '../OriginatorLogo';
|
|
3
|
+
|
|
4
|
+
describe('OriginatorLogo component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(OriginatorLogo, {
|
|
10
|
+
propsData: {
|
|
11
|
+
id: 10,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
component = wrapper.vm;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Created hook', () => {
|
|
18
|
+
expect(wrapper).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('mount component', () => {
|
|
22
|
+
it('renders correctly', () => {
|
|
23
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('Computed properties', () => {
|
|
28
|
+
it('Should have imgSrc', () => {
|
|
29
|
+
expect(component.imgSrc).toEqual('/public/logos/originadores/10/full.svg');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ProductLogo from './ProductLogo.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Example/Logos/ProductLogo',
|
|
5
|
+
component: ProductLogo,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Primary = () => ({
|
|
9
|
+
components: { ProductLogo },
|
|
10
|
+
template: '<ProductLogo alt="primary" id="1" />',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
Primary.storyName = 'Básico';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img :src="imgSrc" />
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import Vue from 'vue';
|
|
6
|
+
|
|
7
|
+
export default Vue.extend({
|
|
8
|
+
name: 'farm-imglogo-product',
|
|
9
|
+
inheritAttrs: true,
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Product id
|
|
13
|
+
*/
|
|
14
|
+
id: {
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Logo variation
|
|
19
|
+
*/
|
|
20
|
+
variation: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'full',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
imgSrc() {
|
|
27
|
+
return `/public/logos/products/${this.id}/${this.variation}.svg`;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ProductLogo from '../ProductLogo';
|
|
3
|
+
|
|
4
|
+
describe('ProductLogo component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(ProductLogo, {
|
|
10
|
+
propsData: {
|
|
11
|
+
id: 10,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
component = wrapper.vm;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Created hook', () => {
|
|
18
|
+
expect(wrapper).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('mount component', () => {
|
|
22
|
+
it('renders correctly', () => {
|
|
23
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('Computed properties', () => {
|
|
28
|
+
it('Should have imgSrc', () => {
|
|
29
|
+
expect(component.imgSrc).toEqual('/public/logos/products/10/full.svg');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import MainFilter from '../MainFilter';
|
|
3
|
+
|
|
4
|
+
describe('MainFilter component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(MainFilter);
|
|
10
|
+
component = wrapper.vm;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('Created hook', () => {
|
|
14
|
+
expect(wrapper).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('methods', () => {
|
|
18
|
+
it('Should emit event', () => {
|
|
19
|
+
component.onFilterClick();
|
|
20
|
+
expect(wrapper.emitted().onClick).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ManagersList from '../ManagersList';
|
|
3
|
+
|
|
4
|
+
describe('ManagersList component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(ManagersList, {
|
|
10
|
+
propsData: {
|
|
11
|
+
managersString: 'a,b,c',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
component = wrapper.vm;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Created hook', () => {
|
|
18
|
+
expect(wrapper).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Computed properties', () => {
|
|
22
|
+
it('Should have managers array', () => {
|
|
23
|
+
expect(component.managers).toBeInstanceOf(Array);
|
|
24
|
+
expect(component.managers.length).toEqual(3);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/main.js
CHANGED
|
@@ -16,7 +16,10 @@ import PromptUserToConfirm from './components/PromptUserToConfirm';
|
|
|
16
16
|
import ModalPromptUser from './components/ModalPromptUser';
|
|
17
17
|
|
|
18
18
|
import TableContextMenu from './components/TableContextMenu';
|
|
19
|
-
import
|
|
19
|
+
import IconBox from './components/IconBox';
|
|
20
|
+
import CardContext from './components/CardContext';
|
|
21
|
+
|
|
22
|
+
import DefaultButton from './components/Buttons/DefaultButton/DefaultButton';
|
|
20
23
|
|
|
21
24
|
export {
|
|
22
25
|
DataTableEmptyWrapper,
|
|
@@ -37,6 +40,8 @@ export {
|
|
|
37
40
|
TableContextMenu,
|
|
38
41
|
ModalPromptUser,
|
|
39
42
|
DefaultButton,
|
|
43
|
+
IconBox,
|
|
44
|
+
CardContext,
|
|
40
45
|
};
|
|
41
46
|
|
|
42
47
|
export * from './components/Buttons/DefaultButton/';
|
|
@@ -46,3 +51,5 @@ export * from './components/Buttons/ExportButton/';
|
|
|
46
51
|
export * from './components/Buttons/ImportButton/';
|
|
47
52
|
export * from './components/Buttons/ToggleButton/';
|
|
48
53
|
export * from './components/Buttons/RemoveButton/';
|
|
54
|
+
export * from './components/Logos/ProductLogo/';
|
|
55
|
+
export * from './components/Logos/OriginatorLogo/';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import MainFilter from './MainFilter';
|
|
3
|
-
|
|
4
|
-
describe('MainFilter component', () => {
|
|
5
|
-
let wrapper;
|
|
6
|
-
let component;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
wrapper = shallowMount(MainFilter);
|
|
10
|
-
component = wrapper.vm;
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('Created hook', () => {
|
|
14
|
-
expect(wrapper).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('methods', () => {
|
|
18
|
-
describe('onKeyUp', () => {
|
|
19
|
-
it('Should change value after throttle', done => {
|
|
20
|
-
const mockEvent = { target: { value: 'some value' } };
|
|
21
|
-
const spy = jest.spyOn(component, '$emit');
|
|
22
|
-
component.onKeyUp(mockEvent);
|
|
23
|
-
setTimeout(() => {
|
|
24
|
-
expect(spy).toHaveBeenCalledWith('onInputChange', 'some value');
|
|
25
|
-
done();
|
|
26
|
-
}, 300);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('Should clear timer', async () => {
|
|
30
|
-
await wrapper.setData({ timer: true });
|
|
31
|
-
const mockEvent = { target: { value: 'some value' } };
|
|
32
|
-
const spy = jest.spyOn(window, 'clearTimeout');
|
|
33
|
-
component.onKeyUp(mockEvent);
|
|
34
|
-
expect(spy).toHaveBeenCalled();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('Should emit event', () => {
|
|
39
|
-
component.onFilterClick();
|
|
40
|
-
expect(wrapper.emitted().onClick).toBeTruthy();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|