@ukhomeoffice/cop-react-form-renderer 1.0.0-gamma → 2.1.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.
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +16 -5
- package/dist/components/CheckYourAnswers/CheckYourAnswers.stories.mdx +199 -79
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +44 -0
- package/dist/components/FormPage/FormPage.js +8 -2
- package/dist/components/FormPage/FormPage.test.js +3 -3
- package/dist/components/FormRenderer/FormRenderer.js +44 -16
- package/dist/components/FormRenderer/FormRenderer.stories.mdx +115 -49
- package/dist/components/FormRenderer/FormRenderer.test.js +40 -0
- package/dist/components/FormRenderer/handlers/getPageId.js +1 -10
- package/dist/components/FormRenderer/handlers/getPageId.test.js +5 -31
- package/dist/components/FormRenderer/handlers/handlers.test.js +2 -2
- package/dist/components/FormRenderer/helpers/getNextPageId.js +33 -26
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +89 -7
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +27 -0
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +209 -0
- package/dist/components/FormRenderer/helpers/index.js +4 -1
- package/dist/components/PageActions/ActionButton.test.js +1 -1
- package/dist/components/PageActions/PageActions.stories.mdx +1 -1
- package/dist/components/PageActions/PageActions.test.js +5 -5
- package/dist/components/SummaryList/RowAction.js +1 -1
- package/dist/components/SummaryList/RowAction.test.js +6 -6
- package/dist/components/SummaryList/SummaryList.js +8 -5
- package/dist/components/SummaryList/SummaryList.scss +10 -2
- package/dist/components/SummaryList/SummaryList.stories.mdx +64 -10
- package/dist/components/SummaryList/SummaryList.test.js +54 -0
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +2 -2
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +4 -4
- package/dist/components/index.js +8 -0
- package/dist/index.js +8 -0
- package/dist/json/areYouACivilServant.json +7 -0
- package/dist/json/firstForm.json +94 -0
- package/dist/json/grade.json +108 -0
- package/dist/json/saveAndContinue.json +98 -0
- package/dist/json/team.json +17351 -0
- package/dist/json/userProfile.data.json +14 -0
- package/dist/json/userProfile.json +276 -0
- package/dist/models/ComponentTypes.js +7 -1
- package/dist/models/PageAction.js +9 -7
- package/dist/utils/CheckYourAnswers/getCYAAction.js +24 -3
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +62 -15
- package/dist/utils/CheckYourAnswers/getCYARow.js +8 -2
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +11 -5
- package/dist/utils/Component/getComponent.js +32 -0
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +75 -0
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +129 -0
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +129 -0
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +80 -0
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +33 -0
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +45 -0
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +31 -0
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +80 -0
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +125 -0
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +80 -0
- package/dist/utils/Component/getComponentTests/getComponent.textarea.test.js +76 -0
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +14 -0
- package/dist/utils/Component/isEditable.js +1 -1
- package/dist/utils/Data/refDataToOptions.js +4 -0
- package/dist/utils/Data/refDataToOptions.test.js +30 -0
- package/dist/utils/FormPage/getEditableComponents.js +28 -0
- package/dist/utils/FormPage/getEditableComponents.test.js +75 -0
- package/dist/utils/FormPage/getFormPage.js +5 -1
- package/dist/utils/FormPage/getPageActions.js +66 -0
- package/dist/utils/FormPage/getPageActions.test.js +89 -0
- package/dist/utils/FormPage/index.js +7 -1
- package/dist/utils/FormPage/showFormPage.js +81 -0
- package/dist/utils/FormPage/showFormPage.test.js +131 -0
- package/dist/utils/Validate/validateComponent.js +5 -3
- package/dist/utils/Validate/validateRequired.js +11 -0
- package/dist/utils/Validate/validateRequired.test.js +12 -0
- package/package.json +15 -10
- package/dist/index.test.js +0 -18
- package/dist/utils/Component/getComponent.test.js +0 -329
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Component = _interopRequireDefault(require("../Component"));
|
|
9
|
+
|
|
10
|
+
var _Data = _interopRequireDefault(require("../Data"));
|
|
11
|
+
|
|
12
|
+
var _meetsCondition = _interopRequireDefault(require("../meetsCondition"));
|
|
13
|
+
|
|
14
|
+
var _getEditableComponents = _interopRequireDefault(require("./getEditableComponents"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
// Local imports
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Evaluates the show_when condition(s) on a page.
|
|
22
|
+
* @param {object} page The page to consider.
|
|
23
|
+
* @param {object} data The top-level form data.
|
|
24
|
+
* @returns Boolean true if all show_when conditions are met; false otherwise.
|
|
25
|
+
*/
|
|
26
|
+
var evaluatePageShowWhen = function evaluatePageShowWhen(page, data) {
|
|
27
|
+
var show_when = Array.isArray(page.show_when) ? page.show_when : [page.show_when];
|
|
28
|
+
var allConditionsMet = true;
|
|
29
|
+
show_when.forEach(function (condition) {
|
|
30
|
+
var sourceDataValue = _Data.default.getSource(data, condition.field);
|
|
31
|
+
|
|
32
|
+
allConditionsMet = allConditionsMet && (0, _meetsCondition.default)(condition, sourceDataValue);
|
|
33
|
+
});
|
|
34
|
+
return allConditionsMet;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Checks whether any of the editable components on a page should be shown.
|
|
38
|
+
* @param {Array} editableComponents The editable components on the page.
|
|
39
|
+
* @param {object} data The top-level form data.
|
|
40
|
+
* @returns Boolean true if ANY of the editable components should be shown; false otherwise.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var showEditableComponent = function showEditableComponent(editableComponents, data) {
|
|
45
|
+
return editableComponents.reduce(function (shown, component) {
|
|
46
|
+
return shown || _Component.default.show(component, data);
|
|
47
|
+
}, false);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Indicates whether or not a page should be shown.
|
|
51
|
+
* @param {object} page The page to consider.
|
|
52
|
+
* @param {object} data The top-level form data.
|
|
53
|
+
* @returns Boolean true if the page should be shown; false if not.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var showFormPage = function showFormPage(page, data) {
|
|
58
|
+
if (!page) {
|
|
59
|
+
return false;
|
|
60
|
+
} // If the page has a show_when condition, we should evaluate that.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if (page.show_when) {
|
|
64
|
+
return evaluatePageShowWhen(page, data);
|
|
65
|
+
} // If the page itself doesn't have a show_when, we need to make sure that if it
|
|
66
|
+
// contains ANY editable components, at least one of them is shown.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
var editableComponents = (0, _getEditableComponents.default)(page);
|
|
70
|
+
|
|
71
|
+
if (editableComponents.length > 0) {
|
|
72
|
+
return showEditableComponent(editableComponents, data);
|
|
73
|
+
} // At this point, either the page has no show_when condition of its own, or
|
|
74
|
+
// the page has no editable components. In either case, it should be shown.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var _default = showFormPage;
|
|
81
|
+
exports.default = _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _showFormPage = _interopRequireDefault(require("./showFormPage"));
|
|
4
|
+
|
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
+
|
|
7
|
+
describe('utils', function () {
|
|
8
|
+
describe('FormPage', function () {
|
|
9
|
+
describe('showFormPage', function () {
|
|
10
|
+
var DATA = {
|
|
11
|
+
alpha: 'Alpha',
|
|
12
|
+
bravo: 'Bravo'
|
|
13
|
+
};
|
|
14
|
+
var HTML = {
|
|
15
|
+
type: 'html',
|
|
16
|
+
tagName: 'p',
|
|
17
|
+
content: 'Alpha'
|
|
18
|
+
};
|
|
19
|
+
var INSET_TEXT = {
|
|
20
|
+
type: 'inset-text',
|
|
21
|
+
content: 'Bravo'
|
|
22
|
+
};
|
|
23
|
+
var HEADING = {
|
|
24
|
+
type: 'heading',
|
|
25
|
+
size: 'm',
|
|
26
|
+
content: 'Charlie'
|
|
27
|
+
};
|
|
28
|
+
it('should NOT be shown when the page is null', function () {
|
|
29
|
+
expect((0, _showFormPage.default)(null, DATA)).toBeFalsy();
|
|
30
|
+
});
|
|
31
|
+
it('should NOT be shown when the page has a single show_when condition that is NOT matched', function () {
|
|
32
|
+
var PAGE = {
|
|
33
|
+
show_when: {
|
|
34
|
+
field: 'charlie',
|
|
35
|
+
op: '=',
|
|
36
|
+
value: 'Charlie'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeFalsy();
|
|
40
|
+
});
|
|
41
|
+
it('should NOT be shown when the page has a multiple show_when conditions and at least one is NOT matched', function () {
|
|
42
|
+
var PAGE = {
|
|
43
|
+
show_when: [{
|
|
44
|
+
field: 'alpha',
|
|
45
|
+
op: '=',
|
|
46
|
+
value: 'Alpha'
|
|
47
|
+
}, {
|
|
48
|
+
field: 'charlie',
|
|
49
|
+
op: '=',
|
|
50
|
+
value: 'Charlie'
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
53
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeFalsy();
|
|
54
|
+
});
|
|
55
|
+
it('SHOULD be shown when the page has a single show_when condition that IS matched', function () {
|
|
56
|
+
var PAGE = {
|
|
57
|
+
show_when: {
|
|
58
|
+
field: 'alpha',
|
|
59
|
+
op: '=',
|
|
60
|
+
value: 'Alpha'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
it('SHOULD be shown when the page has a multiple show_when conditions that are ALL matched', function () {
|
|
66
|
+
var PAGE = {
|
|
67
|
+
show_when: [{
|
|
68
|
+
field: 'alpha',
|
|
69
|
+
op: '=',
|
|
70
|
+
value: 'Alpha'
|
|
71
|
+
}, {
|
|
72
|
+
field: 'charlie',
|
|
73
|
+
op: '!=',
|
|
74
|
+
value: 'Charlie'
|
|
75
|
+
}]
|
|
76
|
+
};
|
|
77
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeTruthy();
|
|
78
|
+
});
|
|
79
|
+
it('SHOULD be shown when the page has NO show_when conditions and NO editable components', function () {
|
|
80
|
+
var PAGE = {
|
|
81
|
+
components: [HTML, INSET_TEXT, HEADING]
|
|
82
|
+
};
|
|
83
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeTruthy();
|
|
84
|
+
});
|
|
85
|
+
it('should NOT be shown when the page has NO show_when conditions and NO SHOWN editable components', function () {
|
|
86
|
+
var TEXT = {
|
|
87
|
+
type: 'text',
|
|
88
|
+
show_when: {
|
|
89
|
+
field: 'charlie',
|
|
90
|
+
op: '=',
|
|
91
|
+
value: 'Charlie'
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var RADIOS = {
|
|
95
|
+
type: 'radios',
|
|
96
|
+
show_when: {
|
|
97
|
+
field: 'charlie',
|
|
98
|
+
op: '=',
|
|
99
|
+
value: 'Charlie'
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var PAGE = {
|
|
103
|
+
components: [TEXT, RADIOS]
|
|
104
|
+
};
|
|
105
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeFalsy();
|
|
106
|
+
});
|
|
107
|
+
it('SHOULD be shown when the page has NO show_when conditions and AT LEAST ONE SHOWN editable components', function () {
|
|
108
|
+
var TEXT = {
|
|
109
|
+
type: 'text',
|
|
110
|
+
show_when: {
|
|
111
|
+
field: 'alpha',
|
|
112
|
+
op: '=',
|
|
113
|
+
value: 'Alpha'
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var RADIOS = {
|
|
117
|
+
type: 'radios',
|
|
118
|
+
show_when: {
|
|
119
|
+
field: 'charlie',
|
|
120
|
+
op: '=',
|
|
121
|
+
value: 'Charlie'
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var PAGE = {
|
|
125
|
+
components: [TEXT, RADIOS]
|
|
126
|
+
};
|
|
127
|
+
expect((0, _showFormPage.default)(PAGE, DATA)).toBeTruthy();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -7,10 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _models = require("../../models");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _showComponent = _interopRequireDefault(require("../Component/showComponent"));
|
|
11
11
|
|
|
12
12
|
var _validateEmail = _interopRequireDefault(require("./validateEmail"));
|
|
13
13
|
|
|
14
|
+
var _validateRequired = _interopRequireDefault(require("./validateRequired"));
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
@@ -25,11 +27,11 @@ var validateComponent = function validateComponent(component, formData) {
|
|
|
25
27
|
var error = undefined;
|
|
26
28
|
var data = formData && _typeof(formData) === 'object' ? formData : {};
|
|
27
29
|
|
|
28
|
-
if (component) {
|
|
30
|
+
if (component && (0, _showComponent.default)(component, formData)) {
|
|
29
31
|
var value = data[component.fieldId];
|
|
30
32
|
|
|
31
33
|
if (component.required) {
|
|
32
|
-
error = (0, _validateRequired.default)(value, component.label);
|
|
34
|
+
error = (0, _validateRequired.default)(value, component.label, component.custom_errors);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
if (!error && component.type === _models.ComponentTypes.EMAIL) {
|
|
@@ -14,6 +14,7 @@ exports.default = void 0;
|
|
|
14
14
|
*/
|
|
15
15
|
var validateRequired = function validateRequired(value) {
|
|
16
16
|
var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
17
|
+
var customErrors = arguments.length > 2 ? arguments[2] : undefined;
|
|
17
18
|
var hasValue = false;
|
|
18
19
|
|
|
19
20
|
if (!!value || value === false || value === 0) {
|
|
@@ -27,6 +28,16 @@ var validateRequired = function validateRequired(value) {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
if (!hasValue) {
|
|
31
|
+
if (Array.isArray(customErrors)) {
|
|
32
|
+
var result = customErrors.filter(function (error) {
|
|
33
|
+
return error.type === 'required';
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (result && result.length > 0 && result[0].message) {
|
|
37
|
+
return result[0].message;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
var name = label ? label : 'Field';
|
|
31
42
|
return "".concat(name, " is required");
|
|
32
43
|
}
|
|
@@ -45,6 +45,18 @@ describe('utils', function () {
|
|
|
45
45
|
it('should use a default label when none is specified', function () {
|
|
46
46
|
expect((0, _validateRequired.default)(undefined, undefined)).toEqual('Field is required');
|
|
47
47
|
});
|
|
48
|
+
it('should use a custom error when one is provided', function () {
|
|
49
|
+
expect((0, _validateRequired.default)(undefined, undefined, [{
|
|
50
|
+
type: 'required',
|
|
51
|
+
message: 'custom error message'
|
|
52
|
+
}])).toEqual('custom error message');
|
|
53
|
+
});
|
|
54
|
+
it('should ignore a custom error when not of type required', function () {
|
|
55
|
+
expect((0, _validateRequired.default)(undefined, undefined, [{
|
|
56
|
+
type: 'genericError',
|
|
57
|
+
message: 'generic error message'
|
|
58
|
+
}])).toEqual('Field is required');
|
|
59
|
+
});
|
|
48
60
|
});
|
|
49
61
|
});
|
|
50
62
|
});
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
7
7
|
"test": "react-scripts test",
|
|
8
|
+
"test:coverage": "yarn test --coverage --watchAll=false",
|
|
8
9
|
"lint": "eslint --ext .js,.jsx src",
|
|
9
|
-
"storybook:start": "start-storybook --docs --no-manager-cache -p 6007",
|
|
10
|
+
"storybook:start": "start-storybook --docs -s src/assets --no-manager-cache -p 6007",
|
|
10
11
|
"storybook:build": "build-storybook --docs -s src/assets",
|
|
11
12
|
"storybook:deploy": "yarn deploy-storybook",
|
|
12
13
|
"storybook": "yarn storybook:start",
|
|
13
14
|
"deploy-storybook": "storybook-to-ghpages -e storybook-static",
|
|
14
15
|
"compile": "yarn clean && cross-env NODE_ENV=production babel src --out-dir dist --copy-files && yarn post-compile",
|
|
15
|
-
"post-compile": "rimraf dist/**/*.test.* dist/**/*.stories.* dist/
|
|
16
|
+
"post-compile": "rimraf dist/*.test.* dist/**/*.test.* dist/**/*.stories.* dist/docs dist/assets"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@ukhomeoffice/cop-react-components": "
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "1.1.2",
|
|
19
20
|
"axios": "^0.21.1",
|
|
20
21
|
"govuk-frontend": "^3.13.0",
|
|
21
22
|
"web-vitals": "^1.0.1"
|
|
@@ -44,14 +45,14 @@
|
|
|
44
45
|
"cross-env": "^7.0.3",
|
|
45
46
|
"html-react-parser": "^0.10.5",
|
|
46
47
|
"node-sass": "^6.0.1",
|
|
47
|
-
"react": "^
|
|
48
|
-
"react-dom": "^
|
|
48
|
+
"react": "^16.13.1",
|
|
49
|
+
"react-dom": "^16.13.1",
|
|
49
50
|
"react-scripts": "4.0.3",
|
|
50
51
|
"storybook-addon-mock": "^2.0.1"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
54
|
+
"react": "^16.13.1",
|
|
55
|
+
"react-dom": "^16.13.1",
|
|
55
56
|
"react-scripts": "4.0.3"
|
|
56
57
|
},
|
|
57
58
|
"optionalDependencies": {
|
|
@@ -74,8 +75,12 @@
|
|
|
74
75
|
],
|
|
75
76
|
"overrides": [
|
|
76
77
|
{
|
|
77
|
-
"files": [
|
|
78
|
-
|
|
78
|
+
"files": [
|
|
79
|
+
"**/*.stories.*"
|
|
80
|
+
],
|
|
81
|
+
"rules": {
|
|
82
|
+
"import/no-anonymous-default-export": "off"
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
]
|
|
81
86
|
},
|
package/dist/index.test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
var _ = _interopRequireWildcard(require("."));
|
|
6
|
-
|
|
7
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
8
|
-
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
|
|
11
|
-
// Local imports
|
|
12
|
-
it('should have exported everything appropriately', function () {
|
|
13
|
-
expect(_.default).toBeDefined();
|
|
14
|
-
expect(_.FormTypes).toBeDefined();
|
|
15
|
-
expect(_.HubFormats).toBeDefined();
|
|
16
|
-
expect(_.intercepts).toBeDefined();
|
|
17
|
-
expect(_.Utils).toBeDefined();
|
|
18
|
-
});
|