@contentful/field-editor-boolean 1.4.2 → 1.4.5
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/dist/cjs/Boolean.spec.js
CHANGED
|
@@ -28,7 +28,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
28
28
|
if (cache && cache.has(obj)) {
|
|
29
29
|
return cache.get(obj);
|
|
30
30
|
}
|
|
31
|
-
var newObj = {
|
|
31
|
+
var newObj = {
|
|
32
|
+
__proto__: null
|
|
33
|
+
};
|
|
32
34
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
33
35
|
for(var key in obj){
|
|
34
36
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -53,7 +55,7 @@ describe('BooleanEditor', ()=>{
|
|
|
53
55
|
afterEach(_react1.cleanup);
|
|
54
56
|
it('renders inputs for true and false values', ()=>{
|
|
55
57
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)();
|
|
56
|
-
const { container
|
|
58
|
+
const { container, getByLabelText } = (0, _react1.render)(_react.createElement(_BooleanEditor.BooleanEditor, {
|
|
57
59
|
field: field,
|
|
58
60
|
isInitiallyDisabled: false
|
|
59
61
|
}));
|
|
@@ -81,7 +83,7 @@ describe('BooleanEditor', ()=>{
|
|
|
81
83
|
...field
|
|
82
84
|
};
|
|
83
85
|
});
|
|
84
|
-
const { getByLabelText
|
|
86
|
+
const { getByLabelText, queryByText, getByText } = (0, _react1.render)(_react.createElement(_BooleanEditor.BooleanEditor, {
|
|
85
87
|
field: field,
|
|
86
88
|
isInitiallyDisabled: false,
|
|
87
89
|
parameters: {
|
|
@@ -106,7 +108,7 @@ describe('BooleanEditor', ()=>{
|
|
|
106
108
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
107
109
|
return field;
|
|
108
110
|
}, true);
|
|
109
|
-
const { getByTestId
|
|
111
|
+
const { getByTestId, getByLabelText } = (0, _react1.render)(_react.createElement(_BooleanEditor.BooleanEditor, {
|
|
110
112
|
field: field,
|
|
111
113
|
isInitiallyDisabled: true
|
|
112
114
|
}));
|
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,7 +60,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
60
|
return newObj;
|
|
59
61
|
}
|
|
60
62
|
function BooleanEditor(props) {
|
|
61
|
-
const { field
|
|
63
|
+
const { field } = props;
|
|
62
64
|
const options = [
|
|
63
65
|
{
|
|
64
66
|
value: true,
|
|
@@ -81,7 +83,7 @@ function BooleanEditor(props) {
|
|
|
81
83
|
debounce: 0,
|
|
82
84
|
field: field,
|
|
83
85
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
84
|
-
}, ({ disabled
|
|
86
|
+
}, ({ disabled, value, setValue })=>{
|
|
85
87
|
const setOption = (value)=>{
|
|
86
88
|
setValue(value === 'true' ? true : false);
|
|
87
89
|
};
|
package/dist/esm/Boolean.spec.js
CHANGED
|
@@ -10,7 +10,7 @@ describe('BooleanEditor', ()=>{
|
|
|
10
10
|
afterEach(cleanup);
|
|
11
11
|
it('renders inputs for true and false values', ()=>{
|
|
12
12
|
const [field] = createFakeFieldAPI();
|
|
13
|
-
const { container
|
|
13
|
+
const { container, getByLabelText } = render(React.createElement(BooleanEditor, {
|
|
14
14
|
field: field,
|
|
15
15
|
isInitiallyDisabled: false
|
|
16
16
|
}));
|
|
@@ -38,7 +38,7 @@ describe('BooleanEditor', ()=>{
|
|
|
38
38
|
...field
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
|
-
const { getByLabelText
|
|
41
|
+
const { getByLabelText, queryByText, getByText } = render(React.createElement(BooleanEditor, {
|
|
42
42
|
field: field,
|
|
43
43
|
isInitiallyDisabled: false,
|
|
44
44
|
parameters: {
|
|
@@ -63,7 +63,7 @@ describe('BooleanEditor', ()=>{
|
|
|
63
63
|
const [field] = createFakeFieldAPI((field)=>{
|
|
64
64
|
return field;
|
|
65
65
|
}, true);
|
|
66
|
-
const { getByTestId
|
|
66
|
+
const { getByTestId, getByLabelText } = render(React.createElement(BooleanEditor, {
|
|
67
67
|
field: field,
|
|
68
68
|
isInitiallyDisabled: true
|
|
69
69
|
}));
|
|
@@ -4,7 +4,7 @@ import { FieldConnector } from '@contentful/field-editor-shared';
|
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import { nanoid } from 'nanoid';
|
|
6
6
|
export function BooleanEditor(props) {
|
|
7
|
-
const { field
|
|
7
|
+
const { field } = props;
|
|
8
8
|
const options = [
|
|
9
9
|
{
|
|
10
10
|
value: true,
|
|
@@ -27,7 +27,7 @@ export function BooleanEditor(props) {
|
|
|
27
27
|
debounce: 0,
|
|
28
28
|
field: field,
|
|
29
29
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
30
|
-
}, ({ disabled
|
|
30
|
+
}, ({ disabled, value, setValue })=>{
|
|
31
31
|
const setOption = (value)=>{
|
|
32
32
|
setValue(value === 'true' ? true : false);
|
|
33
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FieldAPI, ParametersAPI } from '@contentful/field-editor-shared';
|
|
3
3
|
export interface BooleanEditorProps {
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ export interface BooleanEditorProps {
|
|
|
17
17
|
falseLabel?: string;
|
|
18
18
|
}, Record<string, any>>;
|
|
19
19
|
}
|
|
20
|
-
export declare function BooleanEditor(props: BooleanEditorProps):
|
|
20
|
+
export declare function BooleanEditor(props: BooleanEditorProps): JSX.Element;
|
|
21
21
|
export declare namespace BooleanEditor {
|
|
22
22
|
var defaultProps: {
|
|
23
23
|
isInitiallyDisabled: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-boolean",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,16 +37,19 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@contentful/f36-components": "^4.0.27",
|
|
39
39
|
"@contentful/f36-tokens": "^4.0.0",
|
|
40
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
40
|
+
"@contentful/field-editor-shared": "^1.4.5",
|
|
41
41
|
"emotion": "^10.0.17",
|
|
42
42
|
"lodash": "^4.17.15",
|
|
43
43
|
"nanoid": "^3.1.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
46
|
+
"@contentful/field-editor-test-utils": "^1.4.6"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=16.8.0"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"registry": "https://npm.pkg.github.com/"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "142d2039f023bf4ced956aae1dd08b27c35fdbaa"
|
|
52
55
|
}
|