@farm-investimentos/front-mfe-components 2.3.0 → 2.4.3

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.
Files changed (38) hide show
  1. package/dist/front-mfe-components.common.js +424 -84
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +1 -1
  4. package/dist/front-mfe-components.umd.js +424 -84
  5. package/dist/front-mfe-components.umd.js.map +1 -1
  6. package/dist/front-mfe-components.umd.min.js +1 -1
  7. package/dist/front-mfe-components.umd.min.js.map +1 -1
  8. package/package.json +76 -76
  9. package/src/components/AlertReload/AlertReload.vue +34 -32
  10. package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
  11. package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +16 -0
  12. package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +16 -0
  13. package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +16 -0
  14. package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +14 -0
  15. package/src/components/CardContext/CardContext.scss +46 -0
  16. package/src/components/CardContext/CardContext.stories.js +47 -0
  17. package/src/components/CardContext/CardContext.vue +96 -0
  18. package/src/components/CardContext/__tests__/CardContext.spec.js +20 -0
  19. package/src/components/CardContext/index.js +3 -0
  20. package/src/components/DataTableHeader/DataTableHeader.scss +1 -1
  21. package/src/components/DataTableHeader/DataTableHeader.stories.js +1 -1
  22. package/src/components/DataTableHeader/DataTableHeader.vue +47 -3
  23. package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +89 -0
  24. package/src/components/DataTablePaginator/__tests__/DataTablePaginator.spec.js +20 -0
  25. package/src/components/DatePicker/__tests__/DatePicker.spec.js +24 -0
  26. package/src/components/DefaultTextField/__tests__/DefaultTextField.spec.js +25 -0
  27. package/src/components/DialogFooter/__tests__/DialogFooter.spec.js +20 -0
  28. package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +24 -0
  29. package/src/components/IconBox/IconBox.scss +14 -0
  30. package/src/components/IconBox/IconBox.stories.js +13 -0
  31. package/src/components/IconBox/IconBox.vue +29 -0
  32. package/src/components/IconBox/__tests__/IconBox.spec.js +20 -0
  33. package/src/components/IconBox/index.js +3 -0
  34. package/src/components/MainFilter/__tests__/MainFilter.spec.js +23 -0
  35. package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
  36. package/src/components/Tabs/{Tabs.spec.js → __tests__/Tabs.spec.js} +1 -1
  37. package/src/main.js +5 -0
  38. package/src/components/MainFilter/MainFilter.spec.js +0 -43
@@ -0,0 +1,89 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DataTableHeader from '../DataTableHeader';
3
+
4
+ describe('DataTableHeader component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(DataTableHeader, {
10
+ propsData: {
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,
28
+ },
29
+ });
30
+ component = wrapper.vm;
31
+ });
32
+
33
+ test('Created hook', () => {
34
+ expect(wrapper).toBeDefined();
35
+ });
36
+
37
+ describe('mount component', () => {
38
+ it('renders correctly', () => {
39
+ expect(wrapper.element).toMatchSnapshot();
40
+ });
41
+ });
42
+
43
+ describe('Methods', () => {
44
+ it('Should check if item is data-table-select column', () => {
45
+ expect(component.isTHDataTableSelect({ value: 'data-table-select' })).toBeTruthy();
46
+ expect(component.isTHDataTableSelect({ value: 'anything else' })).toBeFalsy();
47
+ });
48
+
49
+ it('Should get th width', () => {
50
+ expect(component.thWidth({ value: 'data-table-select' })).toEqual('64px');
51
+ expect(component.thWidth({ width: 24 })).toEqual('24px');
52
+ expect(component.thWidth({})).toEqual('auto');
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
+ });
88
+ });
89
+ });
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DataTablePaginator from '../DataTablePaginator';
3
+
4
+ describe('DataTablePaginator component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DataTablePaginator);
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,24 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DatePicker from '../DatePicker';
3
+
4
+ describe('DatePicker component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DatePicker, {
9
+ propsData: {
10
+ inputId: 'someid',
11
+ },
12
+ });
13
+ });
14
+
15
+ test('Created hook', () => {
16
+ expect(wrapper).toBeDefined();
17
+ });
18
+
19
+ describe('mount component', () => {
20
+ it('renders correctly', () => {
21
+ expect(wrapper.element).toMatchSnapshot();
22
+ });
23
+ });
24
+ });
@@ -0,0 +1,25 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DefaultTextField from '../DefaultTextField';
3
+
4
+ describe('DefaultTextField component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DefaultTextField, {
9
+ propsData: {
10
+ item: {},
11
+ value: false,
12
+ },
13
+ });
14
+ });
15
+
16
+ test('Created hook', () => {
17
+ expect(wrapper).toBeDefined();
18
+ });
19
+
20
+ describe('mount component', () => {
21
+ it('renders correctly', () => {
22
+ expect(wrapper.element).toMatchSnapshot();
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DialogFooter from '../DialogFooter';
3
+
4
+ describe('DialogFooter component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DialogFooter);
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,24 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import DialogHeader from '../DialogHeader';
3
+
4
+ describe('DialogHeader component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(DialogHeader, {
9
+ propsData: {
10
+ title: ''
11
+ }
12
+ });
13
+ });
14
+
15
+ test('Created hook', () => {
16
+ expect(wrapper).toBeDefined();
17
+ });
18
+
19
+ describe('mount component', () => {
20
+ it('renders correctly', () => {
21
+ expect(wrapper.element).toMatchSnapshot();
22
+ });
23
+ });
24
+ });
@@ -0,0 +1,14 @@
1
+ .icon-box {
2
+ width: 40px;
3
+ height: 40px;
4
+ padding: 6px;
5
+ background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #00b493;
6
+ border-radius: 5px;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ }
11
+
12
+ .icon i {
13
+ font-size: 1.875em;
14
+ }
@@ -0,0 +1,13 @@
1
+ import IconBox from './IconBox.vue';
2
+
3
+ export default {
4
+ title: 'Example/IconBox',
5
+ component: IconBox,
6
+ };
7
+
8
+ export const Primary = () => ({
9
+ components: { IconBox },
10
+ template: '<IconBox icon="mdi-currency-usd" />',
11
+ });
12
+
13
+ Primary.storyName = 'Básico';
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div class="icon-box">
3
+ <div class="icon">
4
+ <v-icon color="secondary">{{ icon }}</v-icon>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import Vue from 'vue';
11
+ import VIcon from 'vuetify/lib/components/VIcon';
12
+
13
+ export default Vue.extend({
14
+ name: 'farm-icon-box',
15
+ components: {
16
+ VIcon,
17
+ },
18
+ props: {
19
+ icon: {
20
+ type: String,
21
+ require: true,
22
+ },
23
+ },
24
+ });
25
+ </script>
26
+
27
+ <style lang="sass" scoped>
28
+ @import './IconBox.scss'
29
+ </style>
@@ -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,3 @@
1
+ import IconBox from './IconBox.vue';
2
+
3
+ export default IconBox;
@@ -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
+ });
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import Tabs from './Tabs';
2
+ import Tabs from '../Tabs';
3
3
 
4
4
  describe('Tabs component', () => {
5
5
  let wrapper;
package/src/main.js CHANGED
@@ -16,6 +16,9 @@ import PromptUserToConfirm from './components/PromptUserToConfirm';
16
16
  import ModalPromptUser from './components/ModalPromptUser';
17
17
 
18
18
  import TableContextMenu from './components/TableContextMenu';
19
+ import IconBox from './components/IconBox';
20
+ import CardContext from './components/CardContext';
21
+
19
22
  import DefaultButton from './components/Buttons/DefaultButton/DefaultButton';
20
23
 
21
24
  export {
@@ -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/';
@@ -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
- });