@contentful/field-editor-multiple-line 2.1.0 → 2.1.1
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.
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
|
-
require("
|
|
8
|
+
const _vitest = require("vitest");
|
|
9
9
|
const _MultipleLineEditor = require("./MultipleLineEditor");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
11
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -51,9 +51,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
(0, _react1.configure)({
|
|
52
52
|
testIdAttribute: 'data-test-id'
|
|
53
53
|
});
|
|
54
|
-
describe('MultipleLineEditor', ()=>{
|
|
55
|
-
afterEach(_react1.cleanup);
|
|
56
|
-
it('renders without crashing', ()=>{
|
|
54
|
+
(0, _vitest.describe)('MultipleLineEditor', ()=>{
|
|
55
|
+
(0, _vitest.afterEach)(_react1.cleanup);
|
|
56
|
+
(0, _vitest.it)('renders without crashing', ()=>{
|
|
57
57
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)();
|
|
58
58
|
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleLineEditor.MultipleLineEditor, {
|
|
59
59
|
field: field,
|
|
@@ -61,7 +61,7 @@ describe('MultipleLineEditor', ()=>{
|
|
|
61
61
|
isInitiallyDisabled: false
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
-
it('reads initial value from field.getValue', ()=>{
|
|
64
|
+
(0, _vitest.it)('reads initial value from field.getValue', ()=>{
|
|
65
65
|
const initialValue = 'initial-value';
|
|
66
66
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
67
67
|
return {
|
|
@@ -77,12 +77,12 @@ describe('MultipleLineEditor', ()=>{
|
|
|
77
77
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
|
|
78
78
|
isInitiallyDisabled: false
|
|
79
79
|
}));
|
|
80
|
-
expect(getByTestId('cf-ui-textarea')).toHaveValue(initialValue);
|
|
80
|
+
(0, _vitest.expect)(getByTestId('cf-ui-textarea')).toHaveValue(initialValue);
|
|
81
81
|
});
|
|
82
|
-
it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
|
|
82
|
+
(0, _vitest.it)('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
|
|
83
83
|
const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
_vitest.vi.spyOn(field, 'setValue');
|
|
85
|
+
_vitest.vi.spyOn(field, 'removeValue');
|
|
86
86
|
return {
|
|
87
87
|
...field,
|
|
88
88
|
id: 'field-id'
|
|
@@ -94,16 +94,16 @@ describe('MultipleLineEditor', ()=>{
|
|
|
94
94
|
isInitiallyDisabled: false
|
|
95
95
|
}));
|
|
96
96
|
const $input = getByTestId('cf-ui-textarea');
|
|
97
|
-
expect($input).toHaveValue('');
|
|
97
|
+
(0, _vitest.expect)($input).toHaveValue('');
|
|
98
98
|
_react1.fireEvent.change($input, {
|
|
99
99
|
target: {
|
|
100
100
|
value: 'new-value'
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
expect($input).toHaveValue('new-value');
|
|
103
|
+
(0, _vitest.expect)($input).toHaveValue('new-value');
|
|
104
104
|
await (0, _react1.waitFor)(()=>{
|
|
105
|
-
expect(field.setValue).toHaveBeenCalledTimes(1);
|
|
106
|
-
expect(field.setValue).toHaveBeenLastCalledWith('new-value');
|
|
105
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenCalledTimes(1);
|
|
106
|
+
(0, _vitest.expect)(field.setValue).toHaveBeenLastCalledWith('new-value');
|
|
107
107
|
});
|
|
108
108
|
_react1.fireEvent.change($input, {
|
|
109
109
|
target: {
|
|
@@ -111,9 +111,9 @@ describe('MultipleLineEditor', ()=>{
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
await (0, _react1.waitFor)(()=>{
|
|
114
|
-
expect($input).toHaveValue('');
|
|
115
|
-
expect(field.removeValue).toHaveBeenCalledTimes(1);
|
|
116
|
-
expect(field.removeValue).toHaveBeenLastCalledWith();
|
|
114
|
+
(0, _vitest.expect)($input).toHaveValue('');
|
|
115
|
+
(0, _vitest.expect)(field.removeValue).toHaveBeenCalledTimes(1);
|
|
116
|
+
(0, _vitest.expect)(field.removeValue).toHaveBeenLastCalledWith();
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
|
|
3
3
|
import { cleanup, configure, fireEvent, render, waitFor } from '@testing-library/react';
|
|
4
|
-
import
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
5
|
import { MultipleLineEditor } from './MultipleLineEditor';
|
|
6
6
|
configure({
|
|
7
7
|
testIdAttribute: 'data-test-id'
|
|
@@ -36,8 +36,8 @@ describe('MultipleLineEditor', ()=>{
|
|
|
36
36
|
});
|
|
37
37
|
it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
|
|
38
38
|
const [field] = createFakeFieldAPI((field)=>{
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
vi.spyOn(field, 'setValue');
|
|
40
|
+
vi.spyOn(field, 'removeValue');
|
|
41
41
|
return {
|
|
42
42
|
...field,
|
|
43
43
|
id: 'field-id'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-multiple-line",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
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
40
|
"@contentful/f36-tokens": "^6.1.2",
|
|
41
|
-
"@contentful/field-editor-shared": "^4.4.
|
|
41
|
+
"@contentful/field-editor-shared": "^4.4.1",
|
|
42
42
|
"@emotion/css": "^11.13.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@contentful/field-editor-test-utils": "^3.1.
|
|
45
|
+
"@contentful/field-editor-test-utils": "^3.1.1"
|
|
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": "5fb6c32d2590e72e56a53cb180a155f84d6505d9"
|
|
55
55
|
}
|