@contentful/field-editor-reference 6.22.3 → 6.22.4-canary.21
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/assets/WrappedAssetCard/AssetCardActions.js +4 -4
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryLinkButton.js +3 -3
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryMenuTrigger.js +8 -8
- package/dist/cjs/components/LinkActions/redesignStyles.js +4 -4
- package/dist/cjs/components/LinkActions/styles.js +3 -3
- package/dist/cjs/components/MissingAssetCard/styles.js +3 -3
- package/dist/cjs/components/SpaceName/SpaceName.js +3 -3
- package/dist/cjs/resources/Cards/ResourceCard.spec.js +13 -6
- package/dist/cjs/resources/ExternalResourceCard/ExternalResourceCard.js +3 -3
- package/dist/cjs/resources/MultipleResourceReferenceEditor.spec.js +31 -25
- package/dist/esm/assets/WrappedAssetCard/AssetCardActions.js +1 -1
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryLinkButton.js +1 -1
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryMenuTrigger.js +1 -1
- package/dist/esm/components/LinkActions/redesignStyles.js +1 -1
- package/dist/esm/components/LinkActions/styles.js +1 -1
- package/dist/esm/components/MissingAssetCard/styles.js +1 -1
- package/dist/esm/components/SpaceName/SpaceName.js +1 -1
- package/dist/esm/resources/Cards/ResourceCard.spec.js +14 -7
- package/dist/esm/resources/ExternalResourceCard/ExternalResourceCard.js +1 -1
- package/dist/esm/resources/MultipleResourceReferenceEditor.spec.js +7 -6
- package/dist/types/components/CreateEntryLinkButton/CreateEntryLinkButton.d.ts +1 -1
- package/package.json +9 -8
|
@@ -21,7 +21,7 @@ const _f36components = require("@contentful/f36-components");
|
|
|
21
21
|
const _f36icons = require("@contentful/f36-icons");
|
|
22
22
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
23
23
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
24
|
-
const
|
|
24
|
+
const _css = require("@emotion/css");
|
|
25
25
|
const _get = /*#__PURE__*/ _interop_require_default(require("lodash/get"));
|
|
26
26
|
function _interop_require_default(obj) {
|
|
27
27
|
return obj && obj.__esModule ? obj : {
|
|
@@ -70,16 +70,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
70
70
|
return newObj;
|
|
71
71
|
}
|
|
72
72
|
const styles = {
|
|
73
|
-
dragHandle: (0,
|
|
73
|
+
dragHandle: (0, _css.css)({
|
|
74
74
|
alignSelf: 'stretch'
|
|
75
75
|
}),
|
|
76
76
|
fileInformation: {
|
|
77
|
-
menuItem: (0,
|
|
77
|
+
menuItem: (0, _css.css)({
|
|
78
78
|
'&:disabled': {
|
|
79
79
|
opacity: 1
|
|
80
80
|
}
|
|
81
81
|
}),
|
|
82
|
-
dl: (0,
|
|
82
|
+
dl: (0, _css.css)({
|
|
83
83
|
backgroundColor: _f36tokens.default.gray100,
|
|
84
84
|
borderRadius: _f36tokens.default.borderRadiusMedium,
|
|
85
85
|
padding: _f36tokens.default.spacingXs,
|
|
@@ -12,7 +12,7 @@ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
|
-
const
|
|
15
|
+
const _css = require("@emotion/css");
|
|
16
16
|
const _get = /*#__PURE__*/ _interop_require_default(require("lodash/get"));
|
|
17
17
|
const _CreateEntryMenuTrigger = require("./CreateEntryMenuTrigger");
|
|
18
18
|
function _interop_require_default(obj) {
|
|
@@ -62,14 +62,14 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
62
62
|
return newObj;
|
|
63
63
|
}
|
|
64
64
|
const standardStyles = {
|
|
65
|
-
spinnerMargin: (0,
|
|
65
|
+
spinnerMargin: (0, _css.css)({
|
|
66
66
|
marginRight: _f36tokens.default.spacingXs
|
|
67
67
|
}),
|
|
68
68
|
action: undefined
|
|
69
69
|
};
|
|
70
70
|
const redesignStyles = {
|
|
71
71
|
...standardStyles,
|
|
72
|
-
action: (0,
|
|
72
|
+
action: (0, _css.css)({
|
|
73
73
|
textDecoration: 'none',
|
|
74
74
|
fontWeight: 'bold',
|
|
75
75
|
maxWidth: '300px'
|
|
@@ -12,8 +12,8 @@ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
|
+
const _css = require("@emotion/css");
|
|
15
16
|
const _core = require("@lingui/core");
|
|
16
|
-
const _emotion = require("emotion");
|
|
17
17
|
const _get = /*#__PURE__*/ _interop_require_default(require("lodash/get"));
|
|
18
18
|
function _interop_require_default(obj) {
|
|
19
19
|
return obj && obj.__esModule ? obj : {
|
|
@@ -67,24 +67,24 @@ const menuPlacementMap = {
|
|
|
67
67
|
'bottom-right': 'bottom-end'
|
|
68
68
|
};
|
|
69
69
|
const styles = {
|
|
70
|
-
wrapper: (0,
|
|
70
|
+
wrapper: (0, _css.css)({
|
|
71
71
|
position: 'relative'
|
|
72
72
|
}),
|
|
73
|
-
inputWrapper: (0,
|
|
73
|
+
inputWrapper: (0, _css.css)({
|
|
74
74
|
position: 'relative',
|
|
75
75
|
padding: `${_f36tokens.default.spacing2Xs} ${_f36tokens.default.spacingXs}`
|
|
76
76
|
}),
|
|
77
|
-
title: (0,
|
|
77
|
+
title: (0, _css.css)({
|
|
78
78
|
paddingTop: _f36tokens.default.spacing2Xs,
|
|
79
79
|
fontWeight: _f36tokens.default.fontWeightMedium
|
|
80
80
|
}),
|
|
81
|
-
searchInput: (0,
|
|
81
|
+
searchInput: (0, _css.css)({
|
|
82
82
|
paddingRight: _f36tokens.default.spacingXl,
|
|
83
83
|
textOverflow: 'ellipsis',
|
|
84
84
|
minHeight: '32px',
|
|
85
85
|
maxHeight: '32px'
|
|
86
86
|
}),
|
|
87
|
-
searchIcon: (0,
|
|
87
|
+
searchIcon: (0, _css.css)({
|
|
88
88
|
position: 'absolute',
|
|
89
89
|
right: _f36tokens.default.spacingM,
|
|
90
90
|
top: '50%',
|
|
@@ -92,11 +92,11 @@ const styles = {
|
|
|
92
92
|
zIndex: Number(_f36tokens.default.zIndexDefault),
|
|
93
93
|
fill: _f36tokens.default.gray600
|
|
94
94
|
}),
|
|
95
|
-
separator: (0,
|
|
95
|
+
separator: (0, _css.css)({
|
|
96
96
|
background: _f36tokens.default.gray200,
|
|
97
97
|
margin: '10px 0'
|
|
98
98
|
}),
|
|
99
|
-
dropdownList: (0,
|
|
99
|
+
dropdownList: (0, _css.css)({
|
|
100
100
|
minWidth: '230px',
|
|
101
101
|
borderColor: _f36tokens.default.gray200
|
|
102
102
|
})
|
|
@@ -20,24 +20,24 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
23
|
-
const
|
|
23
|
+
const _css = require("@emotion/css");
|
|
24
24
|
function _interop_require_default(obj) {
|
|
25
25
|
return obj && obj.__esModule ? obj : {
|
|
26
26
|
default: obj
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const container = (0,
|
|
29
|
+
const container = (0, _css.css)({
|
|
30
30
|
display: 'flex',
|
|
31
31
|
border: `1px dashed ${_f36tokens.default.gray500}`,
|
|
32
32
|
borderRadius: _f36tokens.default.borderRadiusMedium,
|
|
33
33
|
justifyContent: 'center',
|
|
34
34
|
padding: _f36tokens.default.spacingXl
|
|
35
35
|
});
|
|
36
|
-
const action = (0,
|
|
36
|
+
const action = (0, _css.css)({
|
|
37
37
|
textDecoration: 'none',
|
|
38
38
|
fontWeight: 'bold'
|
|
39
39
|
});
|
|
40
|
-
const chevronIcon = (0,
|
|
40
|
+
const chevronIcon = (0, _css.css)({
|
|
41
41
|
float: 'right',
|
|
42
42
|
marginLeft: _f36tokens.default.spacingXs,
|
|
43
43
|
marginRight: -_f36tokens.default.spacing2Xs
|
|
@@ -17,17 +17,17 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
20
|
-
const
|
|
20
|
+
const _css = require("@emotion/css");
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
23
23
|
default: obj
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
const container = (0,
|
|
26
|
+
const container = (0, _css.css)({
|
|
27
27
|
display: 'flex',
|
|
28
28
|
width: '100%',
|
|
29
29
|
marginTop: _f36tokens.default.spacingS
|
|
30
30
|
});
|
|
31
|
-
const separator = (0,
|
|
31
|
+
const separator = (0, _css.css)({
|
|
32
32
|
marginRight: _f36tokens.default.spacingXl
|
|
33
33
|
});
|
|
@@ -16,11 +16,11 @@ _export(exports, {
|
|
|
16
16
|
return squareCard;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const
|
|
20
|
-
const card = (0,
|
|
19
|
+
const _css = require("@emotion/css");
|
|
20
|
+
const card = (0, _css.css)({
|
|
21
21
|
position: 'relative'
|
|
22
22
|
});
|
|
23
|
-
const squareCard = (0,
|
|
23
|
+
const squareCard = (0, _css.css)({
|
|
24
24
|
display: 'flex',
|
|
25
25
|
alignItems: 'center',
|
|
26
26
|
width: '135px',
|
|
@@ -12,7 +12,7 @@ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
|
-
const
|
|
15
|
+
const _css = require("@emotion/css");
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
18
18
|
default: obj
|
|
@@ -60,11 +60,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
62
|
const styles = {
|
|
63
|
-
spaceIcon: (0,
|
|
63
|
+
spaceIcon: (0, _css.css)({
|
|
64
64
|
flexShrink: 0,
|
|
65
65
|
fill: _f36tokens.default.gray600
|
|
66
66
|
}),
|
|
67
|
-
spaceName: (0,
|
|
67
|
+
spaceName: (0, _css.css)({
|
|
68
68
|
color: _f36tokens.default.gray600,
|
|
69
69
|
fontSize: _f36tokens.default.fontSizeS,
|
|
70
70
|
fontWeight: _f36tokens.default.fontWeightMedium,
|
|
@@ -7,6 +7,7 @@ require("@testing-library/jest-dom");
|
|
|
7
7
|
const _reactquery = require("@contentful/field-editor-shared/react-query");
|
|
8
8
|
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
9
9
|
const _react1 = require("@testing-library/react");
|
|
10
|
+
const _userevent = /*#__PURE__*/ _interop_require_default(require("@testing-library/user-event"));
|
|
10
11
|
const _published_content_typejson = /*#__PURE__*/ _interop_require_default(require("../../__fixtures__/content-type/published_content_type.json"));
|
|
11
12
|
const _published_entry_non_masterjson = /*#__PURE__*/ _interop_require_default(require("../../__fixtures__/entry/published_entry_non_master.json"));
|
|
12
13
|
const _published_entryjson = /*#__PURE__*/ _interop_require_default(require("../../__fixtures__/entry/published_entry.json"));
|
|
@@ -194,8 +195,10 @@ describe('ResourceCard', ()=>{
|
|
|
194
195
|
await (0, _react1.waitFor)(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
|
|
195
196
|
expect(getByText(_published_entryjson.default.fields.exField['en-US'])).toBeDefined();
|
|
196
197
|
expect(getByText(_indifferent_spacejson.default.name)).toBeDefined();
|
|
197
|
-
|
|
198
|
-
await (0, _react1.waitFor)(()=>
|
|
198
|
+
_userevent.default.hover(getByText(_indifferent_spacejson.default.name));
|
|
199
|
+
await (0, _react1.waitFor)(()=>{
|
|
200
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
201
|
+
});
|
|
199
202
|
});
|
|
200
203
|
it('renders entry card with explicit master crn', async ()=>{
|
|
201
204
|
const { getByTestId, getByText } = renderResourceCard({
|
|
@@ -205,8 +208,10 @@ describe('ResourceCard', ()=>{
|
|
|
205
208
|
await (0, _react1.waitFor)(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
|
|
206
209
|
expect(getByText(_published_entryjson.default.fields.exField['en-US'])).toBeDefined();
|
|
207
210
|
expect(getByText(_indifferent_spacejson.default.name)).toBeDefined();
|
|
208
|
-
|
|
209
|
-
await (0, _react1.waitFor)(()=>
|
|
211
|
+
_userevent.default.hover(getByText(_indifferent_spacejson.default.name));
|
|
212
|
+
await (0, _react1.waitFor)(()=>{
|
|
213
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
214
|
+
});
|
|
210
215
|
});
|
|
211
216
|
it('renders entry card with a non master environment', async ()=>{
|
|
212
217
|
const { getByTestId, getByText } = renderResourceCard({
|
|
@@ -216,8 +221,10 @@ describe('ResourceCard', ()=>{
|
|
|
216
221
|
const tooltipContent = `Space: ${_indifferent_spacejson.default.name} (Env.: ${_published_entry_non_masterjson.default.sys.environment.sys.id})`;
|
|
217
222
|
expect(getByText(_published_entry_non_masterjson.default.fields.exField['en-US'])).toBeDefined();
|
|
218
223
|
expect(getByText(_indifferent_spacejson.default.name)).toBeDefined();
|
|
219
|
-
|
|
220
|
-
await (0, _react1.waitFor)(()=>
|
|
224
|
+
_userevent.default.hover(getByText(_indifferent_spacejson.default.name));
|
|
225
|
+
await (0, _react1.waitFor)(()=>{
|
|
226
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
227
|
+
});
|
|
221
228
|
});
|
|
222
229
|
it('renders skeleton while data is loading', async ()=>{
|
|
223
230
|
const queryClient = (0, _fieldeditortestutils.createTestQueryClient)();
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "ExternalResourceCard", {
|
|
|
11
11
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
14
|
-
const
|
|
14
|
+
const _css = require("@emotion/css");
|
|
15
15
|
const _truncate = /*#__PURE__*/ _interop_require_default(require("truncate"));
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -60,10 +60,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
62
|
const styles = {
|
|
63
|
-
subtitle: (0,
|
|
63
|
+
subtitle: (0, _css.css)({
|
|
64
64
|
color: _f36tokens.default.gray600
|
|
65
65
|
}),
|
|
66
|
-
description: (0,
|
|
66
|
+
description: (0, _css.css)({
|
|
67
67
|
color: _f36tokens.default.gray900
|
|
68
68
|
})
|
|
69
69
|
};
|
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
5
6
|
require("@testing-library/jest-dom/extend-expect");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const _react1 = require("@testing-library/react");
|
|
8
|
+
const _userevent = /*#__PURE__*/ _interop_require_default(require("@testing-library/user-event"));
|
|
8
9
|
const _EntityStore = require("../common/EntityStore");
|
|
9
10
|
const _useEditorPermissions = require("../common/useEditorPermissions");
|
|
10
11
|
const _MultipleResourceReferenceEditor = require("./MultipleResourceReferenceEditor");
|
|
11
12
|
const _resourceEditorHelpers = require("./testHelpers/resourceEditorHelpers");
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
12
18
|
function _getRequireWildcardCache(nodeInterop) {
|
|
13
19
|
if (typeof WeakMap !== "function") return null;
|
|
14
20
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -103,16 +109,16 @@ beforeEach(()=>{
|
|
|
103
109
|
describe('Multiple resource editor', ()=>{
|
|
104
110
|
it('renders the action button when no value is set', async ()=>{
|
|
105
111
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition);
|
|
106
|
-
(0,
|
|
112
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
107
113
|
isInitiallyDisabled: false,
|
|
108
114
|
sdk: sdk,
|
|
109
115
|
hasCardEditActions: true,
|
|
110
116
|
viewType: "card",
|
|
111
117
|
parameters: {}
|
|
112
118
|
}));
|
|
113
|
-
const button = await
|
|
119
|
+
const button = await _react1.screen.findByText('Add existing content');
|
|
114
120
|
expect(button).toBeDefined();
|
|
115
|
-
|
|
121
|
+
_userevent.default.click(button);
|
|
116
122
|
const dialogFn = sdk.dialogs.selectMultipleResourceEntities;
|
|
117
123
|
expect(dialogFn).toHaveBeenCalledTimes(1);
|
|
118
124
|
const options = dialogFn.mock.calls[0][0];
|
|
@@ -127,7 +133,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
127
133
|
canLinkEntity: false
|
|
128
134
|
}));
|
|
129
135
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition);
|
|
130
|
-
(0,
|
|
136
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
131
137
|
getEntryRouteHref: ()=>'',
|
|
132
138
|
isInitiallyDisabled: false,
|
|
133
139
|
sdk: sdk,
|
|
@@ -135,22 +141,22 @@ describe('Multiple resource editor', ()=>{
|
|
|
135
141
|
viewType: "card",
|
|
136
142
|
parameters: {}
|
|
137
143
|
}));
|
|
138
|
-
const noPermission = await
|
|
144
|
+
const noPermission = await _react1.screen.findByText(/You don't have permission to view this content/);
|
|
139
145
|
expect(noPermission).toBeDefined();
|
|
140
146
|
});
|
|
141
147
|
it('renders custom actions when passed', async ()=>{
|
|
142
148
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition);
|
|
143
|
-
(0,
|
|
149
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
144
150
|
isInitiallyDisabled: false,
|
|
145
151
|
sdk: sdk,
|
|
146
152
|
hasCardEditActions: true,
|
|
147
153
|
viewType: "card",
|
|
148
154
|
parameters: {},
|
|
149
|
-
renderCustomActions: ()=>/*#__PURE__*/
|
|
155
|
+
renderCustomActions: ()=>/*#__PURE__*/ _react.createElement("div", {
|
|
150
156
|
"data-testid": "custom-actions"
|
|
151
157
|
})
|
|
152
158
|
}));
|
|
153
|
-
const customActions = await
|
|
159
|
+
const customActions = await _react1.screen.findByTestId('custom-actions');
|
|
154
160
|
expect(customActions).toBeDefined();
|
|
155
161
|
});
|
|
156
162
|
describe('with value', ()=>{
|
|
@@ -161,7 +167,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
161
167
|
mockedResources[`${link.sys.linkType}.${link.sys.urn}`] = entryInfos[spaceId];
|
|
162
168
|
}
|
|
163
169
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition, Object.values(entryLinks));
|
|
164
|
-
(0,
|
|
170
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
165
171
|
isInitiallyDisabled: false,
|
|
166
172
|
sdk: sdk,
|
|
167
173
|
hasCardEditActions: true,
|
|
@@ -188,7 +194,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
188
194
|
mockedResources[`${link.sys.linkType}.${link.sys.urn}`] = entryInfos[spaceId];
|
|
189
195
|
}
|
|
190
196
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition, Object.values(entryLinks));
|
|
191
|
-
(0,
|
|
197
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
192
198
|
isInitiallyDisabled: false,
|
|
193
199
|
sdk: sdk,
|
|
194
200
|
hasCardEditActions: true,
|
|
@@ -197,7 +203,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
197
203
|
getEntryRouteHref: ()=>'',
|
|
198
204
|
parameters: {}
|
|
199
205
|
}));
|
|
200
|
-
const linkExistingBtn =
|
|
206
|
+
const linkExistingBtn = _react1.screen.queryByText('Add existing content');
|
|
201
207
|
expect(linkExistingBtn).toBeInTheDocument();
|
|
202
208
|
const entriesArray = Object.values(entryInfos);
|
|
203
209
|
const firstItem = entriesArray[0];
|
|
@@ -214,7 +220,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
214
220
|
mockedResources[`${link.sys.linkType}.${link.sys.urn}`] = entryInfos[spaceId];
|
|
215
221
|
}
|
|
216
222
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition, Object.values(entryLinks));
|
|
217
|
-
(0,
|
|
223
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
218
224
|
isInitiallyDisabled: false,
|
|
219
225
|
sdk: sdk,
|
|
220
226
|
hasCardEditActions: true,
|
|
@@ -223,7 +229,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
223
229
|
getEntryRouteHref: ()=>'',
|
|
224
230
|
parameters: {}
|
|
225
231
|
}));
|
|
226
|
-
const linkExistingBtn =
|
|
232
|
+
const linkExistingBtn = _react1.screen.queryByText('Add existing content');
|
|
227
233
|
expect(linkExistingBtn).toBeInTheDocument();
|
|
228
234
|
const entriesArray = Object.values(entryInfos);
|
|
229
235
|
const lastItem = entriesArray[entriesArray.length - 1];
|
|
@@ -240,7 +246,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
240
246
|
mockedResources[`${link.sys.linkType}.${link.sys.urn}`] = entryInfos[spaceId];
|
|
241
247
|
}
|
|
242
248
|
const sdk = (0, _resourceEditorHelpers.mockSdkForField)(fieldDefinition, Object.values(entryLinks));
|
|
243
|
-
(0,
|
|
249
|
+
(0, _react1.render)(/*#__PURE__*/ _react.createElement(_MultipleResourceReferenceEditor.MultipleResourceReferenceEditor, {
|
|
244
250
|
isInitiallyDisabled: false,
|
|
245
251
|
sdk: sdk,
|
|
246
252
|
hasCardEditActions: true,
|
|
@@ -249,15 +255,15 @@ describe('Multiple resource editor', ()=>{
|
|
|
249
255
|
getEntryRouteHref: ()=>'',
|
|
250
256
|
parameters: {}
|
|
251
257
|
}));
|
|
252
|
-
const linkExistingBtn =
|
|
258
|
+
const linkExistingBtn = _react1.screen.queryByText('Add existing content');
|
|
253
259
|
expect(linkExistingBtn).toBeInTheDocument();
|
|
254
260
|
const entriesArray = Object.values(entryInfos);
|
|
255
261
|
for (const info of entriesArray){
|
|
256
262
|
await clickCardActionsButton(info);
|
|
257
|
-
const removeBtn = await
|
|
263
|
+
const removeBtn = await _react1.screen.findByText('Remove', {
|
|
258
264
|
selector: '[role="menuitem"]'
|
|
259
265
|
});
|
|
260
|
-
|
|
266
|
+
_userevent.default.click(removeBtn);
|
|
261
267
|
}
|
|
262
268
|
expect(sdk.field.setValue).toHaveBeenCalledTimes(3);
|
|
263
269
|
expect(sdk.field.setValue).toHaveBeenCalledWith([]);
|
|
@@ -267,28 +273,28 @@ describe('Multiple resource editor', ()=>{
|
|
|
267
273
|
});
|
|
268
274
|
async function expectToHaveMoveButton(info, buttonString) {
|
|
269
275
|
await clickCardActionsButton(info);
|
|
270
|
-
await
|
|
276
|
+
await _react1.screen.findByText(buttonString, {
|
|
271
277
|
selector: '[role="menuitem"]'
|
|
272
278
|
});
|
|
273
279
|
}
|
|
274
280
|
async function expectToNotHaveMoveButton(info, buttonString) {
|
|
275
281
|
await clickCardActionsButton(info);
|
|
276
|
-
expect(
|
|
282
|
+
expect(_react1.screen.queryByText(buttonString, {
|
|
277
283
|
selector: '[role="menuitem"]'
|
|
278
284
|
})).toBeNull();
|
|
279
285
|
}
|
|
280
286
|
async function clickCardActionsButton(info) {
|
|
281
|
-
|
|
287
|
+
_userevent.default.click(document.body);
|
|
282
288
|
const entryTitle = info.resource.fields.title[info.defaultLocaleCode];
|
|
283
289
|
const spaceName = info.space.name;
|
|
284
290
|
const card = await expectEntryCard(entryTitle, spaceName);
|
|
285
291
|
const actionsBtn = card.querySelector('[data-test-id="cf-ui-card-actions"]');
|
|
286
292
|
expect(actionsBtn).toBeInTheDocument();
|
|
287
|
-
|
|
293
|
+
_userevent.default.click(actionsBtn);
|
|
288
294
|
}
|
|
289
295
|
async function expectEntryCard(entryTitle, spaceName) {
|
|
290
|
-
const title = await
|
|
291
|
-
await
|
|
296
|
+
const title = await _react1.screen.findByText(entryTitle);
|
|
297
|
+
await _react1.screen.findByText(spaceName);
|
|
292
298
|
const theCard = title.closest('[data-test-id="cf-ui-entry-card"]');
|
|
293
299
|
expect(theCard).toBeDefined();
|
|
294
300
|
const actionsBtn = theCard?.querySelector('[data-test-id="cf-ui-card-actions"]');
|
|
@@ -3,7 +3,7 @@ import { MenuItem, Text, MenuSectionTitle } from '@contentful/f36-components';
|
|
|
3
3
|
import { PlusIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
5
|
import { shortenStorageUnit } from '@contentful/field-editor-shared';
|
|
6
|
-
import { css } from 'emotion';
|
|
6
|
+
import { css } from '@emotion/css';
|
|
7
7
|
import get from 'lodash/get';
|
|
8
8
|
const styles = {
|
|
9
9
|
dragHandle: css({
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Button } from '@contentful/f36-components';
|
|
3
3
|
import { CaretDownIcon, PlusIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
|
-
import { css } from 'emotion';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
6
6
|
import get from 'lodash/get';
|
|
7
7
|
import { CreateEntryMenuTrigger } from './CreateEntryMenuTrigger';
|
|
8
8
|
const standardStyles = {
|
|
@@ -2,8 +2,8 @@ import React, { useState, useRef, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { TextInput, Menu } from '@contentful/f36-components';
|
|
3
3
|
import { MagnifyingGlassIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
5
6
|
import { i18n as $_i18n } from "@lingui/core";
|
|
6
|
-
import { css } from 'emotion';
|
|
7
7
|
import get from 'lodash/get';
|
|
8
8
|
const MAX_ITEMS_WITHOUT_SEARCH = 5;
|
|
9
9
|
const menuPlacementMap = {
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Flex, Text, Tooltip } from '@contentful/f36-components';
|
|
3
3
|
import { FolderOpenIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
|
-
import { css } from 'emotion';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
6
6
|
const styles = {
|
|
7
7
|
spaceIcon: css({
|
|
8
8
|
flexShrink: 0,
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
import { SharedQueryClientProvider } from '@contentful/field-editor-shared/react-query';
|
|
4
4
|
import { createTestQueryClient } from '@contentful/field-editor-test-utils';
|
|
5
|
-
import { configure,
|
|
5
|
+
import { configure, render, waitFor } from '@testing-library/react';
|
|
6
|
+
import userEvent from '@testing-library/user-event';
|
|
6
7
|
import publishedCT from '../../__fixtures__/content-type/published_content_type.json';
|
|
7
8
|
import publishedEntryNonMasterEnvironment from '../../__fixtures__/entry/published_entry_non_master.json';
|
|
8
9
|
import publishedEntry from '../../__fixtures__/entry/published_entry.json';
|
|
@@ -144,8 +145,10 @@ describe('ResourceCard', ()=>{
|
|
|
144
145
|
await waitFor(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
|
|
145
146
|
expect(getByText(publishedEntry.fields.exField['en-US'])).toBeDefined();
|
|
146
147
|
expect(getByText(space.name)).toBeDefined();
|
|
147
|
-
|
|
148
|
-
await waitFor(()=>
|
|
148
|
+
userEvent.hover(getByText(space.name));
|
|
149
|
+
await waitFor(()=>{
|
|
150
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
151
|
+
});
|
|
149
152
|
});
|
|
150
153
|
it('renders entry card with explicit master crn', async ()=>{
|
|
151
154
|
const { getByTestId, getByText } = renderResourceCard({
|
|
@@ -155,8 +158,10 @@ describe('ResourceCard', ()=>{
|
|
|
155
158
|
await waitFor(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
|
|
156
159
|
expect(getByText(publishedEntry.fields.exField['en-US'])).toBeDefined();
|
|
157
160
|
expect(getByText(space.name)).toBeDefined();
|
|
158
|
-
|
|
159
|
-
await waitFor(()=>
|
|
161
|
+
userEvent.hover(getByText(space.name));
|
|
162
|
+
await waitFor(()=>{
|
|
163
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
164
|
+
});
|
|
160
165
|
});
|
|
161
166
|
it('renders entry card with a non master environment', async ()=>{
|
|
162
167
|
const { getByTestId, getByText } = renderResourceCard({
|
|
@@ -166,8 +171,10 @@ describe('ResourceCard', ()=>{
|
|
|
166
171
|
const tooltipContent = `Space: ${space.name} (Env.: ${publishedEntryNonMasterEnvironment.sys.environment.sys.id})`;
|
|
167
172
|
expect(getByText(publishedEntryNonMasterEnvironment.fields.exField['en-US'])).toBeDefined();
|
|
168
173
|
expect(getByText(space.name)).toBeDefined();
|
|
169
|
-
|
|
170
|
-
await waitFor(()=>
|
|
174
|
+
userEvent.hover(getByText(space.name));
|
|
175
|
+
await waitFor(()=>{
|
|
176
|
+
expect(getByText(tooltipContent)).toBeVisible();
|
|
177
|
+
});
|
|
171
178
|
});
|
|
172
179
|
it('renders skeleton while data is loading', async ()=>{
|
|
173
180
|
const queryClient = createTestQueryClient();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Badge, EntryCard, MenuItem, MenuDivider, Paragraph, Caption } from '@contentful/f36-components';
|
|
3
3
|
import tokens from '@contentful/f36-tokens';
|
|
4
|
-
import { css } from 'emotion';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
5
5
|
import truncate from 'truncate';
|
|
6
6
|
const styles = {
|
|
7
7
|
subtitle: css({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
2
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
1
|
import * as React from 'react';
|
|
2
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
4
5
|
import { useResource } from '../common/EntityStore';
|
|
5
6
|
import { useEditorPermissions } from '../common/useEditorPermissions';
|
|
6
7
|
import { MultipleResourceReferenceEditor } from './MultipleResourceReferenceEditor';
|
|
@@ -67,7 +68,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
67
68
|
}));
|
|
68
69
|
const button = await screen.findByText('Add existing content');
|
|
69
70
|
expect(button).toBeDefined();
|
|
70
|
-
|
|
71
|
+
userEvent.click(button);
|
|
71
72
|
const dialogFn = sdk.dialogs.selectMultipleResourceEntities;
|
|
72
73
|
expect(dialogFn).toHaveBeenCalledTimes(1);
|
|
73
74
|
const options = dialogFn.mock.calls[0][0];
|
|
@@ -212,7 +213,7 @@ describe('Multiple resource editor', ()=>{
|
|
|
212
213
|
const removeBtn = await screen.findByText('Remove', {
|
|
213
214
|
selector: '[role="menuitem"]'
|
|
214
215
|
});
|
|
215
|
-
|
|
216
|
+
userEvent.click(removeBtn);
|
|
216
217
|
}
|
|
217
218
|
expect(sdk.field.setValue).toHaveBeenCalledTimes(3);
|
|
218
219
|
expect(sdk.field.setValue).toHaveBeenCalledWith([]);
|
|
@@ -233,13 +234,13 @@ async function expectToNotHaveMoveButton(info, buttonString) {
|
|
|
233
234
|
})).toBeNull();
|
|
234
235
|
}
|
|
235
236
|
async function clickCardActionsButton(info) {
|
|
236
|
-
|
|
237
|
+
userEvent.click(document.body);
|
|
237
238
|
const entryTitle = info.resource.fields.title[info.defaultLocaleCode];
|
|
238
239
|
const spaceName = info.space.name;
|
|
239
240
|
const card = await expectEntryCard(entryTitle, spaceName);
|
|
240
241
|
const actionsBtn = card.querySelector('[data-test-id="cf-ui-card-actions"]');
|
|
241
242
|
expect(actionsBtn).toBeInTheDocument();
|
|
242
|
-
|
|
243
|
+
userEvent.click(actionsBtn);
|
|
243
244
|
}
|
|
244
245
|
async function expectEntryCard(entryTitle, spaceName) {
|
|
245
246
|
const title = await screen.findByText(entryTitle);
|
|
@@ -15,5 +15,5 @@ interface CreateEntryLinkButtonProps {
|
|
|
15
15
|
position: 'bottom-left' | 'bottom-right';
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
export declare const CreateEntryLinkButton: ({ contentTypes, onSelect, customDropdownItems, text, testId, hasPlusIcon, useExperimentalStyles, suggestedContentTypeId, dropdownSettings, disabled }: CreateEntryLinkButtonProps) => React.JSX.Element;
|
|
18
|
+
export declare const CreateEntryLinkButton: ({ contentTypes, onSelect, customDropdownItems, text, testId, hasPlusIcon, useExperimentalStyles, suggestedContentTypeId, dropdownSettings, disabled, }: CreateEntryLinkButtonProps) => React.JSX.Element;
|
|
19
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.22.
|
|
3
|
+
"version": "6.22.4-canary.21+dabb1a7b",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"tsc": "tsc -p ./ --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@contentful/f36-components": "^
|
|
40
|
-
"@contentful/f36-icons": "^
|
|
41
|
-
"@contentful/f36-tokens": "^
|
|
39
|
+
"@contentful/f36-components": "^6.7.1",
|
|
40
|
+
"@contentful/f36-icons": "^6.7.1",
|
|
41
|
+
"@contentful/f36-tokens": "^6.1.2",
|
|
42
42
|
"@contentful/field-editor-shared": "^3.0.0",
|
|
43
43
|
"@contentful/mimetype": "^2.2.29",
|
|
44
44
|
"@dnd-kit/core": "^6.0.8",
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
|
+
"@emotion/css": "^11.13.5",
|
|
47
48
|
"@tanstack/react-query": "^4.3.9",
|
|
48
49
|
"constate": "^3.3.2",
|
|
49
50
|
"contentful-management": "^11.66.0",
|
|
50
|
-
"emotion": "^10.0.17",
|
|
51
51
|
"lodash": "^4.17.15",
|
|
52
52
|
"moment": "^2.20.0",
|
|
53
53
|
"p-queue": "^4.0.0",
|
|
@@ -58,15 +58,16 @@
|
|
|
58
58
|
"@contentful/app-sdk": "^4.42.0",
|
|
59
59
|
"@contentful/field-editor-test-utils": "^1.8.0",
|
|
60
60
|
"@lingui/core": "5.3.0",
|
|
61
|
-
"@testing-library/react-hooks": "^8.0.1"
|
|
61
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
62
|
+
"@testing-library/user-event": "^13.1.9"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@contentful/app-sdk": "^4.41.2",
|
|
65
66
|
"@lingui/core": "^5.3.0",
|
|
66
|
-
"react": ">=
|
|
67
|
+
"react": ">=18.3.1"
|
|
67
68
|
},
|
|
68
69
|
"publishConfig": {
|
|
69
70
|
"registry": "https://npm.pkg.github.com/"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "dabb1a7b240f576a01f589a34c05bf41edb2cda2"
|
|
72
73
|
}
|