@zeedhi/teknisa-components-common 1.107.2 → 1.108.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.
Files changed (77) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -7
  3. package/coverage/clover.xml +772 -692
  4. package/coverage/coverage-final.json +47 -47
  5. package/coverage/lcov-report/index.html +15 -15
  6. package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +2 -2
  7. package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +2 -2
  8. package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +7 -7
  9. package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
  10. package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
  11. package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
  12. package/coverage/lcov.info +1459 -1275
  13. package/dist/tek-components-common.esm.js +375 -252
  14. package/dist/tek-components-common.umd.js +375 -252
  15. package/jest.config.js +1 -1
  16. package/package.json +2 -2
  17. package/tests/__helpers__/component-event-helper.ts +5 -5
  18. package/tests/__helpers__/flush-promises-helper.ts +3 -3
  19. package/tests/__helpers__/get-child-helper.ts +27 -27
  20. package/tests/__helpers__/index.ts +3 -3
  21. package/tests/__helpers__/mock-created-helper.ts +12 -12
  22. package/tests/__mocks__/@zeedhi/core/i18n.js +74 -74
  23. package/tests/__mocks__/@zeedhi/core.js +4 -4
  24. package/tests/unit/components/crud/crud-add-button.spec.ts +56 -56
  25. package/tests/unit/components/crud/crud-button.spec.ts +94 -94
  26. package/tests/unit/components/crud/crud-cancel-button.spec.ts +91 -91
  27. package/tests/unit/components/crud/crud-delete-button.spec.ts +122 -122
  28. package/tests/unit/components/crud/crud-form.spec.ts +165 -165
  29. package/tests/unit/components/crud/crud-save-button.spec.ts +118 -118
  30. package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +42 -42
  31. package/tests/unit/components/tek-card-title/CardTitle.spec.ts +34 -34
  32. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +470 -470
  33. package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +364 -364
  34. package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +112 -112
  35. package/tests/unit/components/tek-grid/filter-helper.spec.ts +148 -148
  36. package/tests/unit/components/tek-grid/grid-column.spec.ts +270 -270
  37. package/tests/unit/components/tek-grid/grid-columns-button.spec.ts +195 -195
  38. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +967 -967
  39. package/tests/unit/components/tek-grid/grid.spec.ts +3340 -3116
  40. package/tests/unit/components/tek-grid/layout_options.spec.ts +980 -980
  41. package/tests/unit/components/tek-image/Image.spec.ts +67 -67
  42. package/tests/unit/components/tek-iterable-carousel/iterable-carousel.spec.ts +37 -37
  43. package/tests/unit/components/tek-iterable-component-render/iterable-component-render.spec.ts +200 -200
  44. package/tests/unit/components/tek-loading/Loading.spec.ts +30 -30
  45. package/tests/unit/components/tek-notifications/notifications.spec.ts +201 -201
  46. package/tests/unit/components/tek-product-card/product-card.spec.ts +61 -61
  47. package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +220 -220
  48. package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +86 -86
  49. package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +430 -430
  50. package/tests/unit/components/tree-grid/tree-grid.spec.ts +776 -776
  51. package/tests/unit/utils/grid-base/delete-rows-error.spec.ts +24 -0
  52. package/tests/unit/utils/grid-base/export-options/button-option.spec.ts +44 -44
  53. package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +135 -135
  54. package/tests/unit/utils/grid-base/grid-controller.spec.ts +267 -174
  55. package/tests/unit/utils/report-filter/report-filter.spec.ts +66 -66
  56. package/tsconfig.eslint.json +8 -8
  57. package/types/components/tek-datasource/memory-datasource.d.ts +2 -4
  58. package/types/components/tek-datasource/rest-datasource.d.ts +6 -3
  59. package/types/components/tek-grid/grid.d.ts +50 -6
  60. package/types/components/tek-grid/interfaces.d.ts +5 -3
  61. package/types/components/tek-tree-grid/tree-grid.d.ts +5 -1
  62. package/types/utils/grid-base/grid-base.d.ts +12 -229
  63. package/types/utils/grid-base/grid-controller.d.ts +1 -3
  64. package/types/components/tek-ag-grid/default-icons.d.ts +0 -53
  65. package/types/components/tek-ag-grid/interfaces.d.ts +0 -9
  66. package/types/components/tek-ag-grid/tek-ag-grid.d.ts +0 -35
  67. package/types/components/tek-datasource/datasource.d.ts +0 -94
  68. package/types/components/tek-grid/default-icons.d.ts +0 -53
  69. package/types/components/tek-grid/filter-dynamic-values.d.ts +0 -9
  70. package/types/components/tek-grid/grid-controller.d.ts +0 -19
  71. package/types/components/tek-grid/grid_column.d.ts +0 -14
  72. package/types/components/tek-grid/grid_controller.d.ts +0 -15
  73. package/types/components/tek-grid/tek-grid.d.ts +0 -35
  74. package/types/components/tek-login/interfaces.d.ts +0 -3
  75. package/types/components/tek-login/login-children.d.ts +0 -3
  76. package/types/components/tek-login/login.d.ts +0 -58
  77. package/types/components/tek-login/login_children.d.ts +0 -3
@@ -1,165 +1,165 @@
1
- import { CrudForm } from '../../../../src';
2
-
3
- describe('TekCrudForm', () => {
4
- describe('constructor', () => {
5
- it('should create new TekCrudForm with default values', () => {
6
- const instance = new CrudForm({
7
- name: 'form',
8
- component: 'TekCrudForm',
9
- });
10
- expect(instance.children).toStrictEqual([]);
11
- expect(instance.justify).toBe(undefined);
12
- expect(instance.editing).toBeFalsy();
13
- expect(instance.isVisible).toBeTruthy();
14
- });
15
-
16
- it('should create new TekCrudForm with value prop', () => {
17
- const instance = new CrudForm({
18
- name: 'form',
19
- component: 'TekCrudForm',
20
- value: { input: '1' },
21
- });
22
- expect(instance.value).toEqual({ input: '1' });
23
- });
24
- });
25
-
26
- describe('TekCrudForm methods returns', () => {
27
- it('cancelEdit method', () => {
28
- const eventFn = jest.fn();
29
- const instance = new CrudForm({
30
- name: 'form',
31
- component: 'TekCrudForm',
32
- });
33
- expect(eventFn).not.toHaveBeenCalled();
34
-
35
- instance.events = {
36
- focus: eventFn,
37
- };
38
- instance.focus();
39
- expect(instance.cancelEdit()).toBe(undefined);
40
- });
41
-
42
- it('saveEdit method', () => {
43
- const eventFn = jest.fn();
44
- const instance = new CrudForm({
45
- name: 'form',
46
- component: 'TekCrudForm',
47
- events: {
48
- saveEdit: eventFn,
49
- },
50
- });
51
- const event = new Event('click');
52
- instance.click(event, {} as HTMLElement);
53
- expect(eventFn).not.toHaveBeenCalled();
54
- });
55
-
56
- it('focus method', () => {
57
- const eventFn = jest.fn();
58
- const instance = new CrudForm({
59
- name: 'form',
60
- component: 'TekCrudForm',
61
- });
62
- expect(eventFn).not.toHaveBeenCalled();
63
-
64
- instance.events = {
65
- focus: eventFn,
66
- };
67
- instance.focus();
68
-
69
- expect(instance.focus()).toBe(undefined);
70
- });
71
- });
72
-
73
- describe('onMounted()', () => {
74
- it('should call event', () => {
75
- const method = () => undefined;
76
- const instance = new CrudForm({
77
- name: 'form',
78
- component: 'TekCrudForm',
79
- events: { onMounted: method },
80
- });
81
- const spy = jest.spyOn((instance.events as any), 'onMounted');
82
- const element = document.createElement('div');
83
- instance.onMounted(element as HTMLElement);
84
- expect(spy).toHaveBeenCalledWith({ component: instance, element });
85
- spy.mockClear();
86
- });
87
-
88
- it('should not throw when event is undefined', () => {
89
- const instance = new CrudForm({
90
- name: 'form',
91
- component: 'TekCrudForm',
92
- });
93
- const element = document.createElement('div');
94
- expect(() => { instance.onMounted(element as HTMLElement); }).not.toThrow();
95
- });
96
- });
97
-
98
- describe('updateChild()', () => {
99
- it('should call event', () => {
100
- const instance = new CrudForm({
101
- name: 'form',
102
- component: 'TekCrudForm',
103
- children: [
104
- {
105
- name: 'input',
106
- component: 'Input',
107
- },
108
- ],
109
- });
110
- const child = instance.children[0].component;
111
- expect(instance.updateChild(child as any, 'test')).toBe(undefined);
112
- });
113
-
114
- it('should not throw when event is undefined', () => {
115
- const instance = new CrudForm({
116
- name: 'form',
117
- component: 'TekCrudForm',
118
- });
119
- const element = document.createElement('div');
120
- expect(() => { instance.onMounted(element as HTMLElement); }).not.toThrow();
121
- });
122
- });
123
-
124
- describe('setValue()', () => {
125
- it('when called, should set the form value', () => {
126
- const instance = new CrudForm({
127
- name: 'form',
128
- component: 'TekCrudForm',
129
- children: [
130
- {
131
- name: 'input',
132
- component: 'Input',
133
- },
134
- ],
135
- });
136
-
137
- const newValue = 'new value';
138
- instance.setValue({ input: newValue });
139
- instance.updateChild({ name: 'input' } as any, newValue);
140
-
141
- expect(instance.value).toEqual({ input: 'new value' });
142
- expect(instance.editing).toBeFalsy();
143
- });
144
-
145
- it('when called without autoSave, should set the form value and set editing as true', () => {
146
- const instance = new CrudForm({
147
- name: 'form',
148
- component: 'TekCrudForm',
149
- children: [
150
- {
151
- name: 'input',
152
- component: 'Input',
153
- },
154
- ],
155
- });
156
-
157
- const newValue = 'new value';
158
- instance.setValue({ input: newValue }, false);
159
- instance.updateChild({ name: 'input' } as any, newValue);
160
-
161
- expect(instance.value).toEqual({ input: 'new value' });
162
- expect(instance.editing).toBeTruthy();
163
- });
164
- });
165
- });
1
+ import { CrudForm } from '../../../../src';
2
+
3
+ describe('TekCrudForm', () => {
4
+ describe('constructor', () => {
5
+ it('should create new TekCrudForm with default values', () => {
6
+ const instance = new CrudForm({
7
+ name: 'form',
8
+ component: 'TekCrudForm',
9
+ });
10
+ expect(instance.children).toStrictEqual([]);
11
+ expect(instance.justify).toBe(undefined);
12
+ expect(instance.editing).toBeFalsy();
13
+ expect(instance.isVisible).toBeTruthy();
14
+ });
15
+
16
+ it('should create new TekCrudForm with value prop', () => {
17
+ const instance = new CrudForm({
18
+ name: 'form',
19
+ component: 'TekCrudForm',
20
+ value: { input: '1' },
21
+ });
22
+ expect(instance.value).toEqual({ input: '1' });
23
+ });
24
+ });
25
+
26
+ describe('TekCrudForm methods returns', () => {
27
+ it('cancelEdit method', () => {
28
+ const eventFn = jest.fn();
29
+ const instance = new CrudForm({
30
+ name: 'form',
31
+ component: 'TekCrudForm',
32
+ });
33
+ expect(eventFn).not.toHaveBeenCalled();
34
+
35
+ instance.events = {
36
+ focus: eventFn,
37
+ };
38
+ instance.focus();
39
+ expect(instance.cancelEdit()).toBe(undefined);
40
+ });
41
+
42
+ it('saveEdit method', () => {
43
+ const eventFn = jest.fn();
44
+ const instance = new CrudForm({
45
+ name: 'form',
46
+ component: 'TekCrudForm',
47
+ events: {
48
+ saveEdit: eventFn,
49
+ },
50
+ });
51
+ const event = new Event('click');
52
+ instance.click(event, {} as HTMLElement);
53
+ expect(eventFn).not.toHaveBeenCalled();
54
+ });
55
+
56
+ it('focus method', () => {
57
+ const eventFn = jest.fn();
58
+ const instance = new CrudForm({
59
+ name: 'form',
60
+ component: 'TekCrudForm',
61
+ });
62
+ expect(eventFn).not.toHaveBeenCalled();
63
+
64
+ instance.events = {
65
+ focus: eventFn,
66
+ };
67
+ instance.focus();
68
+
69
+ expect(instance.focus()).toBe(undefined);
70
+ });
71
+ });
72
+
73
+ describe('onMounted()', () => {
74
+ it('should call event', () => {
75
+ const method = () => undefined;
76
+ const instance = new CrudForm({
77
+ name: 'form',
78
+ component: 'TekCrudForm',
79
+ events: { onMounted: method },
80
+ });
81
+ const spy = jest.spyOn((instance.events as any), 'onMounted');
82
+ const element = document.createElement('div');
83
+ instance.onMounted(element as HTMLElement);
84
+ expect(spy).toHaveBeenCalledWith({ component: instance, element });
85
+ spy.mockClear();
86
+ });
87
+
88
+ it('should not throw when event is undefined', () => {
89
+ const instance = new CrudForm({
90
+ name: 'form',
91
+ component: 'TekCrudForm',
92
+ });
93
+ const element = document.createElement('div');
94
+ expect(() => { instance.onMounted(element as HTMLElement); }).not.toThrow();
95
+ });
96
+ });
97
+
98
+ describe('updateChild()', () => {
99
+ it('should call event', () => {
100
+ const instance = new CrudForm({
101
+ name: 'form',
102
+ component: 'TekCrudForm',
103
+ children: [
104
+ {
105
+ name: 'input',
106
+ component: 'Input',
107
+ },
108
+ ],
109
+ });
110
+ const child = instance.children[0].component;
111
+ expect(instance.updateChild(child as any, 'test')).toBe(undefined);
112
+ });
113
+
114
+ it('should not throw when event is undefined', () => {
115
+ const instance = new CrudForm({
116
+ name: 'form',
117
+ component: 'TekCrudForm',
118
+ });
119
+ const element = document.createElement('div');
120
+ expect(() => { instance.onMounted(element as HTMLElement); }).not.toThrow();
121
+ });
122
+ });
123
+
124
+ describe('setValue()', () => {
125
+ it('when called, should set the form value', () => {
126
+ const instance = new CrudForm({
127
+ name: 'form',
128
+ component: 'TekCrudForm',
129
+ children: [
130
+ {
131
+ name: 'input',
132
+ component: 'Input',
133
+ },
134
+ ],
135
+ });
136
+
137
+ const newValue = 'new value';
138
+ instance.setValue({ input: newValue });
139
+ instance.updateChild({ name: 'input' } as any, newValue);
140
+
141
+ expect(instance.value).toEqual({ input: 'new value' });
142
+ expect(instance.editing).toBeFalsy();
143
+ });
144
+
145
+ it('when called without autoSave, should set the form value and set editing as true', () => {
146
+ const instance = new CrudForm({
147
+ name: 'form',
148
+ component: 'TekCrudForm',
149
+ children: [
150
+ {
151
+ name: 'input',
152
+ component: 'Input',
153
+ },
154
+ ],
155
+ });
156
+
157
+ const newValue = 'new value';
158
+ instance.setValue({ input: newValue }, false);
159
+ instance.updateChild({ name: 'input' } as any, newValue);
160
+
161
+ expect(instance.value).toEqual({ input: 'new value' });
162
+ expect(instance.editing).toBeTruthy();
163
+ });
164
+ });
165
+ });
@@ -1,118 +1,118 @@
1
- import { GridEditable } from '@zeedhi/common';
2
- import { CrudForm, CrudSaveButton } from '../../../../src';
3
-
4
- describe('CrudSaveButton', () => {
5
- describe('constructor()', () => {
6
- it('should create new CrudSaveButton with default values', () => {
7
- const instance = new CrudSaveButton({
8
- name: 'button',
9
- component: 'TekCrudSaveButton',
10
- clickShortcutKey: 'ctrl+enter',
11
- });
12
-
13
- expect(instance.clickShortcutKey).toBe('ctrl+enter');
14
- expect(instance.label).toBe('SAVE');
15
- });
16
-
17
- it('should create new CrudSaveButton replace default values', () => {
18
- const instance = new CrudSaveButton({
19
- name: 'button',
20
- component: 'TekCrudSaveButton',
21
- clickShortcutKey: '',
22
- label: 'Salvar',
23
- });
24
-
25
- expect(instance.clickShortcutKey).toBe('ctrl+enter');
26
- expect(instance.label).toBe('Salvar');
27
- });
28
-
29
- it('CrudSaveButton click()', () => {
30
- const method = jest.fn();
31
- const instance = new CrudSaveButton({
32
- name: 'button',
33
- component: 'TekCrudSaveButton',
34
- events: { click: method },
35
- });
36
-
37
- instance.click({} as Event, {} as HTMLElement);
38
- expect(method).not.toHaveBeenCalled();
39
- const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
40
- instance.parent = crudForm;
41
-
42
- instance.click({} as Event, {} as HTMLElement);
43
- expect(method).toHaveBeenCalled();
44
- });
45
-
46
- it('click() CrudForm with defaultPrevent false', () => {
47
- const instance = new CrudSaveButton({
48
- name: 'cancelButton',
49
- component: 'TekCrudCancelButton',
50
- });
51
-
52
- instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
53
- const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
54
- instance.parent = crudForm;
55
- instance.click({ defaultPrevented: true } as Event, {} as HTMLElement);
56
- expect(instance.parent).toBeInstanceOf(CrudForm);
57
- });
58
-
59
- it('CrudSaveButton click() no validate', () => {
60
- const method = jest.fn();
61
- const instance = new CrudSaveButton({
62
- name: 'button',
63
- component: 'TekCrudSaveButton',
64
- events: { click: method },
65
- });
66
-
67
- const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
68
- crudForm.validate = () => false;
69
- instance.parent = crudForm;
70
- instance.click({} as Event, {} as HTMLElement);
71
- expect(method).not.toHaveBeenCalled();
72
- });
73
-
74
- it('CrudSaveButton click() when event is not prevented', () => {
75
- const instance = new CrudSaveButton({
76
- name: 'button',
77
- component: 'TekCrudSaveButton',
78
- });
79
-
80
- const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
81
- instance.parent = crudForm;
82
- instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
83
- expect(crudForm.saveEdit).toBeTruthy();
84
- instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
85
- expect(crudForm.editing).toBeFalsy();
86
- instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
87
- expect(crudForm.editing).toBeFalsy();
88
- });
89
-
90
- it('click() GridEditable', () => {
91
- const method = jest.fn();
92
- const instance = new CrudSaveButton({
93
- name: 'button',
94
- component: 'TekCrudSaveButton',
95
- events: { click: method },
96
- });
97
- const gridEditable = new GridEditable({ name: 'form', component: 'GridEditable' });
98
- instance.click({} as Event, {} as HTMLElement);
99
- expect(method).not.toHaveBeenCalled();
100
- instance.parent = gridEditable;
101
- instance.click({} as Event, {} as HTMLElement);
102
- expect(method).toHaveBeenCalled();
103
- });
104
-
105
- it('click() GridEditable with defaultPrevent false', () => {
106
- const instance = new CrudSaveButton({
107
- name: 'cancelButton',
108
- component: 'TekCrudCancelButton',
109
- });
110
-
111
- instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
112
- const grid = new GridEditable({ name: 'form', component: 'GridEditable' });
113
- instance.parent = grid;
114
- instance.click({ defaultPrevented: true } as Event, {} as HTMLElement);
115
- expect(instance.parent).toBeInstanceOf(GridEditable);
116
- });
117
- });
118
- });
1
+ import { GridEditable } from '@zeedhi/common';
2
+ import { CrudForm, CrudSaveButton } from '../../../../src';
3
+
4
+ describe('CrudSaveButton', () => {
5
+ describe('constructor()', () => {
6
+ it('should create new CrudSaveButton with default values', () => {
7
+ const instance = new CrudSaveButton({
8
+ name: 'button',
9
+ component: 'TekCrudSaveButton',
10
+ clickShortcutKey: 'ctrl+enter',
11
+ });
12
+
13
+ expect(instance.clickShortcutKey).toBe('ctrl+enter');
14
+ expect(instance.label).toBe('SAVE');
15
+ });
16
+
17
+ it('should create new CrudSaveButton replace default values', () => {
18
+ const instance = new CrudSaveButton({
19
+ name: 'button',
20
+ component: 'TekCrudSaveButton',
21
+ clickShortcutKey: '',
22
+ label: 'Salvar',
23
+ });
24
+
25
+ expect(instance.clickShortcutKey).toBe('ctrl+enter');
26
+ expect(instance.label).toBe('Salvar');
27
+ });
28
+
29
+ it('CrudSaveButton click()', () => {
30
+ const method = jest.fn();
31
+ const instance = new CrudSaveButton({
32
+ name: 'button',
33
+ component: 'TekCrudSaveButton',
34
+ events: { click: method },
35
+ });
36
+
37
+ instance.click({} as Event, {} as HTMLElement);
38
+ expect(method).not.toHaveBeenCalled();
39
+ const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
40
+ instance.parent = crudForm;
41
+
42
+ instance.click({} as Event, {} as HTMLElement);
43
+ expect(method).toHaveBeenCalled();
44
+ });
45
+
46
+ it('click() CrudForm with defaultPrevent false', () => {
47
+ const instance = new CrudSaveButton({
48
+ name: 'cancelButton',
49
+ component: 'TekCrudCancelButton',
50
+ });
51
+
52
+ instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
53
+ const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
54
+ instance.parent = crudForm;
55
+ instance.click({ defaultPrevented: true } as Event, {} as HTMLElement);
56
+ expect(instance.parent).toBeInstanceOf(CrudForm);
57
+ });
58
+
59
+ it('CrudSaveButton click() no validate', () => {
60
+ const method = jest.fn();
61
+ const instance = new CrudSaveButton({
62
+ name: 'button',
63
+ component: 'TekCrudSaveButton',
64
+ events: { click: method },
65
+ });
66
+
67
+ const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
68
+ crudForm.validate = () => false;
69
+ instance.parent = crudForm;
70
+ instance.click({} as Event, {} as HTMLElement);
71
+ expect(method).not.toHaveBeenCalled();
72
+ });
73
+
74
+ it('CrudSaveButton click() when event is not prevented', () => {
75
+ const instance = new CrudSaveButton({
76
+ name: 'button',
77
+ component: 'TekCrudSaveButton',
78
+ });
79
+
80
+ const crudForm = new CrudForm({ name: 'form', component: 'CrudForm' });
81
+ instance.parent = crudForm;
82
+ instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
83
+ expect(crudForm.saveEdit).toBeTruthy();
84
+ instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
85
+ expect(crudForm.editing).toBeFalsy();
86
+ instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
87
+ expect(crudForm.editing).toBeFalsy();
88
+ });
89
+
90
+ it('click() GridEditable', () => {
91
+ const method = jest.fn();
92
+ const instance = new CrudSaveButton({
93
+ name: 'button',
94
+ component: 'TekCrudSaveButton',
95
+ events: { click: method },
96
+ });
97
+ const gridEditable = new GridEditable({ name: 'form', component: 'GridEditable' });
98
+ instance.click({} as Event, {} as HTMLElement);
99
+ expect(method).not.toHaveBeenCalled();
100
+ instance.parent = gridEditable;
101
+ instance.click({} as Event, {} as HTMLElement);
102
+ expect(method).toHaveBeenCalled();
103
+ });
104
+
105
+ it('click() GridEditable with defaultPrevent false', () => {
106
+ const instance = new CrudSaveButton({
107
+ name: 'cancelButton',
108
+ component: 'TekCrudCancelButton',
109
+ });
110
+
111
+ instance.click({ defaultPrevented: false } as Event, {} as HTMLElement);
112
+ const grid = new GridEditable({ name: 'form', component: 'GridEditable' });
113
+ instance.parent = grid;
114
+ instance.click({ defaultPrevented: true } as Event, {} as HTMLElement);
115
+ expect(instance.parent).toBeInstanceOf(GridEditable);
116
+ });
117
+ });
118
+ });
@@ -1,42 +1,42 @@
1
- import { BreadcrumbHeader, Image } from '../../../../src';
2
-
3
- describe('BreadcrumbHeader', () => {
4
- describe('constructor()', () => {
5
- it('should create new BreadcrumbHeader with default values', () => {
6
- const instance = new BreadcrumbHeader({
7
- name: 'BreadcrumbHeader',
8
- component: 'TekBreadcrumbHeader',
9
- title: '',
10
- breadcrumb: {
11
- name: 'breadcrumb',
12
- component: 'ZdBreadcrumb',
13
- divider: '>',
14
- },
15
- });
16
- expect(instance.title).toBe('');
17
- expect(instance.rightSlot).toStrictEqual([]);
18
- });
19
-
20
- it('should create new BreadcrumbHeader with rightSlot values', () => {
21
- const image = new Image({
22
- name: 'image',
23
- component: 'tekImage',
24
- src: '/img/zeedhi.svg',
25
- to: 'google.com.br',
26
- });
27
- const instance = new BreadcrumbHeader({
28
- name: 'BreadcrumbHeader',
29
- component: 'TekBreadcrumbHeader',
30
- title: '',
31
- breadcrumb: {
32
- name: 'breadcrumb',
33
- component: 'ZdBreadcrumb',
34
- divider: '>',
35
- },
36
- rightSlot: [image],
37
- });
38
- expect(instance.title).toBe('');
39
- expect(instance.rightSlot).toEqual([image]);
40
- });
41
- });
42
- });
1
+ import { BreadcrumbHeader, Image } from '../../../../src';
2
+
3
+ describe('BreadcrumbHeader', () => {
4
+ describe('constructor()', () => {
5
+ it('should create new BreadcrumbHeader with default values', () => {
6
+ const instance = new BreadcrumbHeader({
7
+ name: 'BreadcrumbHeader',
8
+ component: 'TekBreadcrumbHeader',
9
+ title: '',
10
+ breadcrumb: {
11
+ name: 'breadcrumb',
12
+ component: 'ZdBreadcrumb',
13
+ divider: '>',
14
+ },
15
+ });
16
+ expect(instance.title).toBe('');
17
+ expect(instance.rightSlot).toStrictEqual([]);
18
+ });
19
+
20
+ it('should create new BreadcrumbHeader with rightSlot values', () => {
21
+ const image = new Image({
22
+ name: 'image',
23
+ component: 'tekImage',
24
+ src: '/img/zeedhi.svg',
25
+ to: 'google.com.br',
26
+ });
27
+ const instance = new BreadcrumbHeader({
28
+ name: 'BreadcrumbHeader',
29
+ component: 'TekBreadcrumbHeader',
30
+ title: '',
31
+ breadcrumb: {
32
+ name: 'breadcrumb',
33
+ component: 'ZdBreadcrumb',
34
+ divider: '>',
35
+ },
36
+ rightSlot: [image],
37
+ });
38
+ expect(instance.title).toBe('');
39
+ expect(instance.rightSlot).toEqual([image]);
40
+ });
41
+ });
42
+ });