@contentful/field-editor-single-line 2.1.1 → 2.1.2-canary.11

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.
@@ -158,6 +158,30 @@ function _interop_require_wildcard(obj, nodeInterop) {
158
158
  (0, _vitest.expect)(getByText('Maximum 50000 characters')).toBeInTheDocument();
159
159
  });
160
160
  (0, _vitest.it)('shows proper min-max validation message', ()=>{
161
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
162
+ return {
163
+ ...field,
164
+ type: 'Symbol',
165
+ validations: [
166
+ {
167
+ size: {
168
+ min: 100,
169
+ max: 200
170
+ }
171
+ }
172
+ ],
173
+ id: 'field-id'
174
+ };
175
+ });
176
+ const { getByText } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_SingleLineEditor.SingleLineEditor, {
177
+ field: field,
178
+ isInitiallyDisabled: false,
179
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
180
+ }));
181
+ (0, _vitest.expect)(getByText('0 characters')).toBeInTheDocument();
182
+ (0, _vitest.expect)(getByText('Requires between 100 and 200 characters')).toBeInTheDocument();
183
+ });
184
+ (0, _vitest.it)('caps min-max validation message at the technical limit', ()=>{
161
185
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
162
186
  return {
163
187
  ...field,
@@ -179,7 +203,30 @@ function _interop_require_wildcard(obj, nodeInterop) {
179
203
  locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
180
204
  }));
181
205
  (0, _vitest.expect)(getByText('0 characters')).toBeInTheDocument();
182
- (0, _vitest.expect)(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
206
+ (0, _vitest.expect)(getByText('Requires between 100 and 256 characters')).toBeInTheDocument();
207
+ });
208
+ (0, _vitest.it)('caps max-only validation message at the technical limit', ()=>{
209
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
210
+ return {
211
+ ...field,
212
+ type: 'Symbol',
213
+ validations: [
214
+ {
215
+ size: {
216
+ max: 1000
217
+ }
218
+ }
219
+ ],
220
+ id: 'field-id'
221
+ };
222
+ });
223
+ const { getByText } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_SingleLineEditor.SingleLineEditor, {
224
+ field: field,
225
+ isInitiallyDisabled: false,
226
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
227
+ }));
228
+ (0, _vitest.expect)(getByText('0 characters')).toBeInTheDocument();
229
+ (0, _vitest.expect)(getByText('Maximum 256 characters')).toBeInTheDocument();
183
230
  });
184
231
  (0, _vitest.it)('shows proper min validation message', ()=>{
185
232
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
@@ -113,6 +113,30 @@ describe('SingleLineEditor', ()=>{
113
113
  expect(getByText('Maximum 50000 characters')).toBeInTheDocument();
114
114
  });
115
115
  it('shows proper min-max validation message', ()=>{
116
+ const [field] = createFakeFieldAPI((field)=>{
117
+ return {
118
+ ...field,
119
+ type: 'Symbol',
120
+ validations: [
121
+ {
122
+ size: {
123
+ min: 100,
124
+ max: 200
125
+ }
126
+ }
127
+ ],
128
+ id: 'field-id'
129
+ };
130
+ });
131
+ const { getByText } = render(/*#__PURE__*/ React.createElement(SingleLineEditor, {
132
+ field: field,
133
+ isInitiallyDisabled: false,
134
+ locales: createFakeLocalesAPI()
135
+ }));
136
+ expect(getByText('0 characters')).toBeInTheDocument();
137
+ expect(getByText('Requires between 100 and 200 characters')).toBeInTheDocument();
138
+ });
139
+ it('caps min-max validation message at the technical limit', ()=>{
116
140
  const [field] = createFakeFieldAPI((field)=>{
117
141
  return {
118
142
  ...field,
@@ -134,7 +158,30 @@ describe('SingleLineEditor', ()=>{
134
158
  locales: createFakeLocalesAPI()
135
159
  }));
136
160
  expect(getByText('0 characters')).toBeInTheDocument();
137
- expect(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
161
+ expect(getByText('Requires between 100 and 256 characters')).toBeInTheDocument();
162
+ });
163
+ it('caps max-only validation message at the technical limit', ()=>{
164
+ const [field] = createFakeFieldAPI((field)=>{
165
+ return {
166
+ ...field,
167
+ type: 'Symbol',
168
+ validations: [
169
+ {
170
+ size: {
171
+ max: 1000
172
+ }
173
+ }
174
+ ],
175
+ id: 'field-id'
176
+ };
177
+ });
178
+ const { getByText } = render(/*#__PURE__*/ React.createElement(SingleLineEditor, {
179
+ field: field,
180
+ isInitiallyDisabled: false,
181
+ locales: createFakeLocalesAPI()
182
+ }));
183
+ expect(getByText('0 characters')).toBeInTheDocument();
184
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
138
185
  });
139
186
  it('shows proper min validation message', ()=>{
140
187
  const [field] = createFakeFieldAPI((field)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-single-line",
3
- "version": "2.1.1",
3
+ "version": "2.1.2-canary.11+811c078e",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,11 +38,11 @@
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.1",
41
+ "@contentful/field-editor-shared": "^4.4.2-canary.11+811c078e",
42
42
  "@emotion/css": "^11.13.5"
43
43
  },
44
44
  "devDependencies": {
45
- "@contentful/field-editor-test-utils": "^3.1.1",
45
+ "@contentful/field-editor-test-utils": "^3.1.2-canary.11+811c078e",
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": "5fb6c32d2590e72e56a53cb180a155f84d6505d9"
56
+ "gitHead": "811c078e63fa54aecc9dee1775de9d8122a9cb04"
57
57
  }