@contentful/field-editor-list 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.
|
@@ -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 _ListEditor = require("./ListEditor");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
11
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -51,11 +51,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
(0, _react1.configure)({
|
|
52
52
|
testIdAttribute: 'data-test-id'
|
|
53
53
|
});
|
|
54
|
-
describe('ListEditor', ()=>{
|
|
55
|
-
afterEach(_react1.cleanup);
|
|
54
|
+
(0, _vitest.describe)('ListEditor', ()=>{
|
|
55
|
+
(0, _vitest.afterEach)(_react1.cleanup);
|
|
56
56
|
function expectInputValue({ getByTestId }, expected) {
|
|
57
57
|
const $input = getByTestId('list-editor-input');
|
|
58
|
-
expect($input).toHaveValue(expected);
|
|
58
|
+
(0, _vitest.expect)($input).toHaveValue(expected);
|
|
59
59
|
}
|
|
60
60
|
function changeInputValue({ getByTestId }, value) {
|
|
61
61
|
const $input = getByTestId('list-editor-input');
|
|
@@ -65,7 +65,7 @@ describe('ListEditor', ()=>{
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
it('renders empty value properly', ()=>{
|
|
68
|
+
(0, _vitest.it)('renders empty value properly', ()=>{
|
|
69
69
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((mock)=>{
|
|
70
70
|
return {
|
|
71
71
|
...mock,
|
|
@@ -79,7 +79,7 @@ describe('ListEditor', ()=>{
|
|
|
79
79
|
}));
|
|
80
80
|
expectInputValue(renderResult, '');
|
|
81
81
|
});
|
|
82
|
-
it('renders non-empty value properly', ()=>{
|
|
82
|
+
(0, _vitest.it)('renders non-empty value properly', ()=>{
|
|
83
83
|
const initialValue = [
|
|
84
84
|
'test1',
|
|
85
85
|
'test2',
|
|
@@ -98,10 +98,10 @@ describe('ListEditor', ()=>{
|
|
|
98
98
|
}));
|
|
99
99
|
expectInputValue(renderResult, 'test1, test2, test3');
|
|
100
100
|
});
|
|
101
|
-
it('calls setValue and removeValue when user inputs data', ()=>{
|
|
101
|
+
(0, _vitest.it)('calls setValue and removeValue when user inputs data', ()=>{
|
|
102
102
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
_vitest.vi.spyOn(field, 'setValue');
|
|
104
|
+
_vitest.vi.spyOn(field, 'removeValue');
|
|
105
105
|
return {
|
|
106
106
|
...field,
|
|
107
107
|
validations: []
|
|
@@ -113,23 +113,23 @@ describe('ListEditor', ()=>{
|
|
|
113
113
|
isInitiallyDisabled: false
|
|
114
114
|
}));
|
|
115
115
|
changeInputValue(renderResult, 'test1');
|
|
116
|
-
expect(field.setValue).toHaveBeenLastCalledWith([
|
|
116
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenLastCalledWith([
|
|
117
117
|
'test1'
|
|
118
118
|
]);
|
|
119
119
|
changeInputValue(renderResult, 'test1, test2 , test3');
|
|
120
120
|
expectInputValue(renderResult, 'test1, test2, test3');
|
|
121
|
-
expect(field.setValue).toHaveBeenLastCalledWith([
|
|
121
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenLastCalledWith([
|
|
122
122
|
'test1',
|
|
123
123
|
'test2',
|
|
124
124
|
'test3'
|
|
125
125
|
]);
|
|
126
126
|
changeInputValue(renderResult, '');
|
|
127
|
-
expect(field.removeValue).toHaveBeenCalledTimes(1);
|
|
128
|
-
expect(field.setValue).toHaveBeenCalledTimes(2);
|
|
127
|
+
(0, _vitest.expect)(field.removeValue).toHaveBeenCalledTimes(1);
|
|
128
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenCalledTimes(2);
|
|
129
129
|
});
|
|
130
|
-
it('keeps trailing commas', ()=>{
|
|
130
|
+
(0, _vitest.it)('keeps trailing commas', ()=>{
|
|
131
131
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
132
|
-
|
|
132
|
+
_vitest.vi.spyOn(field, 'setValue');
|
|
133
133
|
return {
|
|
134
134
|
...field,
|
|
135
135
|
validations: []
|
|
@@ -143,14 +143,14 @@ describe('ListEditor', ()=>{
|
|
|
143
143
|
isInitiallyDisabled: false
|
|
144
144
|
}));
|
|
145
145
|
changeInputValue(renderResult, 'test1,');
|
|
146
|
-
expect(field.setValue).toHaveBeenLastCalledWith([
|
|
146
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenLastCalledWith([
|
|
147
147
|
'test1'
|
|
148
148
|
]);
|
|
149
149
|
expectInputValue(renderResult, 'test1,');
|
|
150
150
|
});
|
|
151
|
-
it('listens to external changes', async ()=>{
|
|
151
|
+
(0, _vitest.it)('listens to external changes', async ()=>{
|
|
152
152
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
153
|
-
|
|
153
|
+
_vitest.vi.spyOn(field, 'setValue');
|
|
154
154
|
return {
|
|
155
155
|
...field,
|
|
156
156
|
validations: []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
|
|
3
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
4
3
|
import { cleanup, configure, fireEvent, render, waitFor } from '@testing-library/react';
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
5
|
import { ListEditor } from './ListEditor';
|
|
6
6
|
configure({
|
|
7
7
|
testIdAttribute: 'data-test-id'
|
|
@@ -55,8 +55,8 @@ describe('ListEditor', ()=>{
|
|
|
55
55
|
});
|
|
56
56
|
it('calls setValue and removeValue when user inputs data', ()=>{
|
|
57
57
|
const [field] = createFakeFieldAPI((field)=>{
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
vi.spyOn(field, 'setValue');
|
|
59
|
+
vi.spyOn(field, 'removeValue');
|
|
60
60
|
return {
|
|
61
61
|
...field,
|
|
62
62
|
validations: []
|
|
@@ -84,7 +84,7 @@ describe('ListEditor', ()=>{
|
|
|
84
84
|
});
|
|
85
85
|
it('keeps trailing commas', ()=>{
|
|
86
86
|
const [field] = createFakeFieldAPI((field)=>{
|
|
87
|
-
|
|
87
|
+
vi.spyOn(field, 'setValue');
|
|
88
88
|
return {
|
|
89
89
|
...field,
|
|
90
90
|
validations: []
|
|
@@ -105,7 +105,7 @@ describe('ListEditor', ()=>{
|
|
|
105
105
|
});
|
|
106
106
|
it('listens to external changes', async ()=>{
|
|
107
107
|
const [field] = createFakeFieldAPI((field)=>{
|
|
108
|
-
|
|
108
|
+
vi.spyOn(field, 'setValue');
|
|
109
109
|
return {
|
|
110
110
|
...field,
|
|
111
111
|
validations: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-list",
|
|
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
|
"@emotion/css": "^11.13.5",
|
|
42
42
|
"lodash": "^4.17.15"
|
|
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
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=18.3.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"registry": "https://npm.pkg.github.com/"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3e29f9734b46d8ca738457c87cc76a0aeca459e9"
|
|
55
55
|
}
|