@contentful/field-editor-boolean 2.0.14-canary.0 → 2.1.1-canary.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
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
7
|
-
require("@testing-library/jest-dom/extend-expect");
|
|
8
7
|
const _react1 = require("@testing-library/react");
|
|
8
|
+
const _vitest = require("vitest");
|
|
9
9
|
const _BooleanEditor = require("./BooleanEditor");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
11
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -51,16 +51,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
(0, _react1.configure)({
|
|
52
52
|
testIdAttribute: 'data-test-id'
|
|
53
53
|
});
|
|
54
|
-
describe('BooleanEditor', ()=>{
|
|
55
|
-
afterEach(_react1.cleanup);
|
|
56
|
-
it('renders inputs for true and false values', ()=>{
|
|
54
|
+
(0, _vitest.describe)('BooleanEditor', ()=>{
|
|
55
|
+
(0, _vitest.afterEach)(_react1.cleanup);
|
|
56
|
+
(0, _vitest.it)('renders inputs for true and false values', ()=>{
|
|
57
57
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)();
|
|
58
58
|
const { container, getByLabelText } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_BooleanEditor.BooleanEditor, {
|
|
59
59
|
field: field,
|
|
60
60
|
isInitiallyDisabled: false
|
|
61
61
|
}));
|
|
62
62
|
const $inputs = container.querySelectorAll('input[type="radio"]');
|
|
63
|
-
expect($inputs).toHaveLength(2);
|
|
63
|
+
(0, _vitest.expect)($inputs).toHaveLength(2);
|
|
64
64
|
[
|
|
65
65
|
{
|
|
66
66
|
value: 'true',
|
|
@@ -71,14 +71,14 @@ describe('BooleanEditor', ()=>{
|
|
|
71
71
|
label: 'No'
|
|
72
72
|
}
|
|
73
73
|
].forEach((item, index)=>{
|
|
74
|
-
expect($inputs[index].value).toEqual(item.value);
|
|
74
|
+
(0, _vitest.expect)($inputs[index].value).toEqual(item.value);
|
|
75
75
|
getByLabelText(item.label);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
it('calls setValue and removeValue properly', ()=>{
|
|
78
|
+
(0, _vitest.it)('calls setValue and removeValue properly', ()=>{
|
|
79
79
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
_vitest.vi.spyOn(field, 'setValue');
|
|
81
|
+
_vitest.vi.spyOn(field, 'removeValue');
|
|
82
82
|
return {
|
|
83
83
|
...field
|
|
84
84
|
};
|
|
@@ -95,16 +95,16 @@ describe('BooleanEditor', ()=>{
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}));
|
|
98
|
-
expect(queryByText('Clear')).not.toBeInTheDocument();
|
|
98
|
+
(0, _vitest.expect)(queryByText('Clear')).not.toBeInTheDocument();
|
|
99
99
|
_react1.fireEvent.click(getByLabelText('Yeah, obviously'));
|
|
100
|
-
expect(field.setValue).toHaveBeenCalledWith(true);
|
|
100
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenCalledWith(true);
|
|
101
101
|
_react1.fireEvent.click(getByLabelText('No, of course'));
|
|
102
|
-
expect(field.setValue).toHaveBeenCalledWith(false);
|
|
103
|
-
expect(field.removeValue).toHaveBeenCalledTimes(0);
|
|
102
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenCalledWith(false);
|
|
103
|
+
(0, _vitest.expect)(field.removeValue).toHaveBeenCalledTimes(0);
|
|
104
104
|
_react1.fireEvent.click(getByText('Clear'));
|
|
105
|
-
expect(field.removeValue).toHaveBeenCalledTimes(1);
|
|
105
|
+
(0, _vitest.expect)(field.removeValue).toHaveBeenCalledTimes(1);
|
|
106
106
|
});
|
|
107
|
-
it('all interactive elements are disabled if field is disabled', ()=>{
|
|
107
|
+
(0, _vitest.it)('all interactive elements are disabled if field is disabled', ()=>{
|
|
108
108
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
109
109
|
return field;
|
|
110
110
|
}, true);
|
|
@@ -112,8 +112,8 @@ describe('BooleanEditor', ()=>{
|
|
|
112
112
|
field: field,
|
|
113
113
|
isInitiallyDisabled: true
|
|
114
114
|
}));
|
|
115
|
-
expect(getByLabelText('Yes')).toBeDisabled();
|
|
116
|
-
expect(getByLabelText('No')).toBeDisabled();
|
|
117
|
-
expect(getByTestId('boolean-editor-clear')).toBeDisabled();
|
|
115
|
+
(0, _vitest.expect)(getByLabelText('Yes')).toBeDisabled();
|
|
116
|
+
(0, _vitest.expect)(getByLabelText('No')).toBeDisabled();
|
|
117
|
+
(0, _vitest.expect)(getByTestId('boolean-editor-clear')).toBeDisabled();
|
|
118
118
|
});
|
|
119
119
|
});
|
package/dist/esm/Boolean.spec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createFakeFieldAPI } from '@contentful/field-editor-test-utils';
|
|
3
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
4
3
|
import { cleanup, configure, fireEvent, render } from '@testing-library/react';
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
5
|
import { BooleanEditor } from './BooleanEditor';
|
|
6
6
|
configure({
|
|
7
7
|
testIdAttribute: 'data-test-id'
|
|
@@ -32,8 +32,8 @@ describe('BooleanEditor', ()=>{
|
|
|
32
32
|
});
|
|
33
33
|
it('calls setValue and removeValue properly', ()=>{
|
|
34
34
|
const [field] = createFakeFieldAPI((field)=>{
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
vi.spyOn(field, 'setValue');
|
|
36
|
+
vi.spyOn(field, 'removeValue');
|
|
37
37
|
return {
|
|
38
38
|
...field
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-boolean",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1-canary.5+3e29f973",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"build:types": "tsc --outDir dist/types --emitDeclarationOnly",
|
|
32
32
|
"build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs",
|
|
33
33
|
"build:esm": "swc src --config-file ../../.swcrc -d dist/esm",
|
|
34
|
-
"test": "
|
|
35
|
-
"test:ci": "
|
|
34
|
+
"test": "vitest",
|
|
35
|
+
"test:ci": "vitest run",
|
|
36
36
|
"tsc": "tsc -p ./ --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@contentful/f36-components": "^6.7.1",
|
|
40
|
-
"@contentful/field-editor-shared": "^4.
|
|
40
|
+
"@contentful/field-editor-shared": "^4.4.1-canary.5+3e29f973",
|
|
41
41
|
"lodash": "^4.17.15",
|
|
42
42
|
"nanoid": "^3.1.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@contentful/field-editor-test-utils": "^3.
|
|
45
|
+
"@contentful/field-editor-test-utils": "^3.1.1-canary.5+3e29f973",
|
|
46
46
|
"@lingui/core": "5.3.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"registry": "https://npm.pkg.github.com/"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "3e29f9734b46d8ca738457c87cc76a0aeca459e9"
|
|
57
57
|
}
|