awing-library 2.1.2-dev.584 → 2.1.2-dev.585
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.
|
@@ -9,7 +9,7 @@ var __webpack_modules__ = {
|
|
|
9
9
|
"AWING/DataInput": function(module) {
|
|
10
10
|
module.exports = __WEBPACK_EXTERNAL_MODULE__DataInput_index_js_c7933a4f__;
|
|
11
11
|
},
|
|
12
|
-
"
|
|
12
|
+
"AWING/helper": function(module) {
|
|
13
13
|
module.exports = __WEBPACK_EXTERNAL_MODULE__helper_js_663c9e82__;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -92,9 +92,9 @@ jest.mock('@mui/material', ()=>({
|
|
|
92
92
|
})
|
|
93
93
|
}));
|
|
94
94
|
const mockInputFactory = __webpack_require__("AWING/DataInput")["default"];
|
|
95
|
-
const mockCalculateValue = __webpack_require__("
|
|
96
|
-
const mockConvertFormulaToBinaryTree = __webpack_require__("
|
|
97
|
-
const mockReplaceFieldsValue = __webpack_require__("
|
|
95
|
+
const mockCalculateValue = __webpack_require__("AWING/helper").calculateValue;
|
|
96
|
+
const mockConvertFormulaToBinaryTree = __webpack_require__("AWING/helper").convertFormulaToBinaryTree;
|
|
97
|
+
const mockReplaceFieldsValue = __webpack_require__("AWING/helper").replaceFieldsValue;
|
|
98
98
|
describe('DataForm Component', ()=>{
|
|
99
99
|
const mockFields = [
|
|
100
100
|
{
|
package/package.json
CHANGED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import "@testing-library/jest-dom";
|
|
3
|
-
import "react";
|
|
4
|
-
import { fireEvent, render } from "@testing-library/react";
|
|
5
|
-
import { driver } from "./DateRangePicker.driver.js";
|
|
6
|
-
import container_0 from "../container.js";
|
|
7
|
-
import moment from "moment";
|
|
8
|
-
var __webpack_require__ = {};
|
|
9
|
-
(()=>{
|
|
10
|
-
__webpack_require__.g = (()=>{
|
|
11
|
-
if ('object' == typeof globalThis) return globalThis;
|
|
12
|
-
try {
|
|
13
|
-
return this || new Function('return this')();
|
|
14
|
-
} catch (e) {
|
|
15
|
-
if ('object' == typeof window) return window;
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
})();
|
|
19
|
-
const initData = {
|
|
20
|
-
autoFocus: false,
|
|
21
|
-
autoFocusEndDate: false,
|
|
22
|
-
initialStartDate: null,
|
|
23
|
-
initialEndDate: null,
|
|
24
|
-
callback: ()=>{},
|
|
25
|
-
disabled: false,
|
|
26
|
-
isDayBlocked: (day)=>false,
|
|
27
|
-
isOutsideRange: (day)=>false,
|
|
28
|
-
isShowCalendarInfo: false,
|
|
29
|
-
handleValid: ()=>{},
|
|
30
|
-
handleDateRangePopover: ()=>{}
|
|
31
|
-
};
|
|
32
|
-
describe('Render', ()=>{
|
|
33
|
-
it('should render input mask', ()=>{
|
|
34
|
-
const { container } = render(/*#__PURE__*/ jsx(container_0, {
|
|
35
|
-
...initData
|
|
36
|
-
}));
|
|
37
|
-
const inputmask = container.querySelector(driver.inputmask);
|
|
38
|
-
expect(inputmask).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
it('should show popper when clicked inputmask', ()=>{
|
|
41
|
-
jest.useFakeTimers();
|
|
42
|
-
jest.spyOn(__webpack_require__.g, 'setTimeout');
|
|
43
|
-
const { container } = render(/*#__PURE__*/ jsx(container_0, {
|
|
44
|
-
...initData
|
|
45
|
-
}));
|
|
46
|
-
const inputmask = container.querySelector(driver.inputmask);
|
|
47
|
-
inputmask && fireEvent.click(inputmask);
|
|
48
|
-
jest.advanceTimersByTime(1000);
|
|
49
|
-
});
|
|
50
|
-
it('should show popper when clicked inputmask', ()=>{
|
|
51
|
-
jest.useFakeTimers();
|
|
52
|
-
jest.spyOn(__webpack_require__.g, 'setTimeout');
|
|
53
|
-
const { container } = render(/*#__PURE__*/ jsx(container_0, {
|
|
54
|
-
...initData,
|
|
55
|
-
value: {
|
|
56
|
-
startDate: moment('2021-10-20'),
|
|
57
|
-
endDate: moment('2021-10-25')
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
const inputmaskInput = container.querySelector(driver.inputmaskInput);
|
|
61
|
-
expect(inputmaskInput).toHaveValue('20/10/2021 - 25/10/2021');
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe('init', ()=>{
|
|
65
|
-
it('should autofocus', ()=>{
|
|
66
|
-
jest.mock('react-dates/constants', ()=>({
|
|
67
|
-
START_DATE: 'startDate',
|
|
68
|
-
END_DATE: 'endDate'
|
|
69
|
-
}));
|
|
70
|
-
const autoFocus = true;
|
|
71
|
-
const autoFocusEndDate = false;
|
|
72
|
-
render(/*#__PURE__*/ jsx(container_0, {
|
|
73
|
-
...initData,
|
|
74
|
-
autoFocus: autoFocus,
|
|
75
|
-
autoFocusEndDate: autoFocusEndDate
|
|
76
|
-
}));
|
|
77
|
-
if (autoFocus) 'startDate';
|
|
78
|
-
else if (autoFocusEndDate) 'endDate';
|
|
79
|
-
});
|
|
80
|
-
it('should autoFocusEndDate', ()=>{
|
|
81
|
-
jest.mock('react-dates/constants', ()=>({
|
|
82
|
-
START_DATE: 'startDate',
|
|
83
|
-
END_DATE: 'endDate'
|
|
84
|
-
}));
|
|
85
|
-
const autoFocus = false;
|
|
86
|
-
const autoFocusEndDate = true;
|
|
87
|
-
render(/*#__PURE__*/ jsx(container_0, {
|
|
88
|
-
...initData,
|
|
89
|
-
autoFocusEndDate: autoFocusEndDate
|
|
90
|
-
}));
|
|
91
|
-
if (autoFocus) 'startDate';
|
|
92
|
-
else if (autoFocusEndDate) 'endDate';
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
describe('action', ()=>{
|
|
96
|
-
it('should autoFocus', ()=>{
|
|
97
|
-
const autoFocus = true;
|
|
98
|
-
const { container } = render(/*#__PURE__*/ jsx(container_0, {
|
|
99
|
-
...initData,
|
|
100
|
-
autoFocus: autoFocus
|
|
101
|
-
}));
|
|
102
|
-
const inputmaskButton = container.querySelector(driver.inputmaskButton);
|
|
103
|
-
inputmaskButton && fireEvent.click(inputmaskButton);
|
|
104
|
-
expect(inputmaskButton).toHaveBeenCalled();
|
|
105
|
-
});
|
|
106
|
-
});
|