@osimatic/helpers-js 1.5.3 → 1.5.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/details_sub_array.js +45 -41
- package/form_helper.js +283 -232
- package/google_charts.js +154 -144
- package/google_maps.js +1 -1
- package/import_from_csv.js +166 -157
- package/multi_files_input.js +42 -34
- package/multiple_action_in_table.js +115 -105
- package/package.json +1 -1
- package/paging.js +103 -84
- package/select_all.js +65 -70
- package/sortable_list.js +12 -13
- package/tests/details_sub_array.test.js +211 -239
- package/tests/form_helper.test.js +553 -673
- package/tests/google_charts.test.js +338 -339
- package/tests/google_maps.test.js +3 -15
- package/tests/import_from_csv.test.js +391 -652
- package/tests/multi_files_input.test.js +292 -722
- package/tests/multiple_action_in_table.test.js +439 -417
- package/tests/paging.test.js +344 -475
- package/tests/select_all.test.js +232 -318
- package/tests/sortable_list.test.js +176 -500
- package/tests/user.test.js +163 -54
- package/user.js +35 -38
|
@@ -85,17 +85,6 @@ describe('GoogleMap', () => {
|
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
// Mock jQuery
|
|
89
|
-
global.$ = jest.fn((selector) => {
|
|
90
|
-
if (typeof selector === 'string') {
|
|
91
|
-
if (selector.startsWith('#map')) {
|
|
92
|
-
return { length: 1 };
|
|
93
|
-
}
|
|
94
|
-
return { length: 0 };
|
|
95
|
-
}
|
|
96
|
-
return { length: 0 };
|
|
97
|
-
});
|
|
98
|
-
|
|
99
88
|
// Mock document.getElementById
|
|
100
89
|
document.getElementById = jest.fn((id) => {
|
|
101
90
|
return { id: id };
|
|
@@ -108,12 +97,11 @@ describe('GoogleMap', () => {
|
|
|
108
97
|
afterEach(() => {
|
|
109
98
|
jest.clearAllMocks();
|
|
110
99
|
delete global.google;
|
|
111
|
-
delete global.$;
|
|
112
100
|
});
|
|
113
101
|
|
|
114
102
|
describe('constructor', () => {
|
|
115
103
|
test('should return early when element does not exist', () => {
|
|
116
|
-
|
|
104
|
+
document.getElementById = jest.fn(() => null);
|
|
117
105
|
|
|
118
106
|
const googleMap = new GoogleMap('nonexistent');
|
|
119
107
|
|
|
@@ -149,10 +137,10 @@ describe('GoogleMap', () => {
|
|
|
149
137
|
expect(mockMap.setZoom).toHaveBeenCalledWith(6);
|
|
150
138
|
});
|
|
151
139
|
|
|
152
|
-
test('should check if element exists
|
|
140
|
+
test('should check if element exists via getElementById', () => {
|
|
153
141
|
const googleMap = new GoogleMap('my-map');
|
|
154
142
|
|
|
155
|
-
expect(
|
|
143
|
+
expect(document.getElementById).toHaveBeenCalledWith('my-map');
|
|
156
144
|
});
|
|
157
145
|
});
|
|
158
146
|
|