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

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.0",
3
+ "version": "2.4.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -7,17 +7,17 @@
7
7
  v-bind:class="[
8
8
  item.sortable ? 'sortable' : '',
9
9
  sortClick[$index].clicked ? 'active' : '',
10
- item.sortable && sortClick[$index].descending === 'DESC' ? 'DESC' : 'ASC',
10
+ item.sortable ? (sortClick[$index].descending === 'DESC' ? 'DESC' : 'ASC') : '',
11
11
  ]"
12
12
  v-bind:style="{
13
- textAlign: item.align,
13
+ textAlign: item.align ? item.align : '',
14
14
  width: thWidth(item),
15
15
  }"
16
16
  @click="item.sortable ? clickSort(item.value, $index) : ''"
17
17
  @mouseover="changeShow($index)"
18
18
  @mouseout="changeHidden($index)"
19
19
  >
20
- <span class="header-text">
20
+ <span class="header-text" v-if="!isTHDataTableSelect(item)">
21
21
  {{ item.text }}
22
22
 
23
23
  <v-icon
@@ -111,8 +111,14 @@ export default Vue.extend({
111
111
  return false;
112
112
  },
113
113
  thWidth(item) {
114
+ if (this.isTHDataTableSelect(item)) {
115
+ return '64px';
116
+ }
114
117
  return item.width ? item.width + 'px' : 'auto';
115
118
  },
119
+ isTHDataTableSelect(item) {
120
+ return item.value === 'data-table-select';
121
+ },
116
122
  },
117
123
  created() {
118
124
  for (let i = 0; i < this.headers.length; i += 1) {
@@ -0,0 +1,39 @@
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
+ });
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('Methods', () => {
28
+ it('Should check if item is data-table-select column', () => {
29
+ expect(component.isTHDataTableSelect({ value: 'data-table-select' })).toBeTruthy();
30
+ expect(component.isTHDataTableSelect({ value: 'anything else' })).toBeFalsy();
31
+ });
32
+
33
+ it('Should get th width', () => {
34
+ expect(component.thWidth({ value: 'data-table-select' })).toEqual('64px');
35
+ expect(component.thWidth({ width: 24 })).toEqual('24px');
36
+ expect(component.thWidth({})).toEqual('auto');
37
+ });
38
+ });
39
+ });
@@ -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
+ });