@contentful/field-editor-rich-text 6.3.7 → 6.3.8

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.
Files changed (72) hide show
  1. package/dist/cjs/Toolbar/_tests_/toolbar.test.js +13 -13
  2. package/dist/cjs/helpers/__tests__/extractNodes.test.js +16 -15
  3. package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +5 -4
  4. package/dist/cjs/helpers/__tests__/toSlateDoc.test.js +4 -3
  5. package/dist/cjs/helpers/__tests__/validations.test.js +9 -8
  6. package/dist/cjs/helpers/formatDateAndTime.spec.js +44 -43
  7. package/dist/cjs/helpers/sdkNavigatorSlideIn.spec.js +38 -37
  8. package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +5 -4
  9. package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +4 -3
  10. package/dist/cjs/plugins/CharCounter/utils.spec.js +6 -5
  11. package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +14 -12
  12. package/dist/cjs/plugins/CommandPalette/utils/insertBlock.test.js +11 -9
  13. package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +10 -9
  14. package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +3 -2
  15. package/dist/cjs/plugins/Hyperlink/__tests__/recommendations-searchQuery.test.js +15 -11
  16. package/dist/cjs/plugins/List/__tests__/createListPlugin.test.js +6 -5
  17. package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +3 -2
  18. package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +3 -2
  19. package/dist/cjs/plugins/List/transforms/moveListItems.test.js +5 -4
  20. package/dist/cjs/plugins/List/transforms/toggleList.spec.js +13 -12
  21. package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +11 -10
  22. package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +11 -10
  23. package/dist/cjs/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +4 -3
  24. package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +8 -7
  25. package/dist/cjs/plugins/Table/__tests__/createTablePlugin.test.js +13 -12
  26. package/dist/cjs/plugins/Table/__tests__/helpers.test.js +2 -1
  27. package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +5 -4
  28. package/dist/cjs/plugins/shared/__tests__/EmbeddedBlockUtil.test.js +16 -14
  29. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +11 -11
  30. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +11 -11
  31. package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +21 -21
  32. package/dist/cjs/test-utils/assertOutput.js +3 -2
  33. package/dist/cjs/test-utils/createTestEditor.js +2 -1
  34. package/dist/esm/Toolbar/_tests_/toolbar.test.js +3 -3
  35. package/dist/esm/helpers/__tests__/extractNodes.test.js +1 -0
  36. package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +1 -0
  37. package/dist/esm/helpers/__tests__/toSlateDoc.test.js +1 -0
  38. package/dist/esm/helpers/__tests__/validations.test.js +1 -0
  39. package/dist/esm/helpers/formatDateAndTime.spec.js +4 -3
  40. package/dist/esm/helpers/sdkNavigatorSlideIn.spec.js +4 -3
  41. package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +1 -0
  42. package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +1 -0
  43. package/dist/esm/plugins/CharCounter/utils.spec.js +3 -2
  44. package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +7 -5
  45. package/dist/esm/plugins/CommandPalette/utils/insertBlock.test.js +5 -3
  46. package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +1 -0
  47. package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +1 -0
  48. package/dist/esm/plugins/Hyperlink/__tests__/recommendations-searchQuery.test.js +4 -3
  49. package/dist/esm/plugins/List/__tests__/createListPlugin.test.js +1 -0
  50. package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +1 -0
  51. package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +1 -0
  52. package/dist/esm/plugins/List/transforms/moveListItems.test.js +1 -0
  53. package/dist/esm/plugins/List/transforms/toggleList.spec.js +1 -0
  54. package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +1 -0
  55. package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +1 -0
  56. package/dist/esm/plugins/PasteHTML/utils/__tests__/sanitizeHTML.test.js +1 -0
  57. package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +1 -0
  58. package/dist/esm/plugins/Table/__tests__/createTablePlugin.test.js +1 -0
  59. package/dist/esm/plugins/Table/__tests__/helpers.test.js +1 -0
  60. package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +1 -0
  61. package/dist/esm/plugins/shared/__tests__/EmbeddedBlockUtil.test.js +11 -9
  62. package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +5 -5
  63. package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +6 -6
  64. package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +7 -7
  65. package/dist/esm/test-utils/assertOutput.js +1 -0
  66. package/dist/esm/test-utils/createTestEditor.js +2 -1
  67. package/dist/types/Toolbar/_tests_/toolbar.test.d.ts +1 -1
  68. package/dist/types/plugins/Hyperlink/__tests__/recommendations-searchQuery.test.d.ts +1 -0
  69. package/dist/types/plugins/shared/__tests__/FetchingWrappedAssetCard.test.d.ts +1 -1
  70. package/dist/types/plugins/shared/__tests__/FetchingWrappedEntryCard.test.d.ts +1 -1
  71. package/dist/types/plugins/shared/__tests__/FetchingWrappedResourceCard.test.d.ts +1 -1
  72. package/package.json +7 -7
@@ -6,7 +6,7 @@ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
6
6
  const _richtexttypes = require("@contentful/rich-text-types");
7
7
  const _react1 = require("@testing-library/react");
8
8
  const _platecommon = require("@udecode/plate-common");
9
- require("@testing-library/jest-dom/extend-expect");
9
+ const _vitest = require("vitest");
10
10
  const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
11
11
  const _SdkProvider = require("../../SdkProvider");
12
12
  const _index = /*#__PURE__*/ _interop_require_default(require("../index"));
@@ -65,7 +65,7 @@ const mockSdk = (marks)=>{
65
65
  default: 'en-US'
66
66
  },
67
67
  entry: {
68
- getSys: jest.fn().mockReturnValue({
68
+ getSys: _vitest.vi.fn().mockReturnValue({
69
69
  id: 'entry-id'
70
70
  })
71
71
  },
@@ -79,7 +79,7 @@ const mockSdk = (marks)=>{
79
79
  ]
80
80
  },
81
81
  access: {
82
- can: jest.fn().mockResolvedValue(true)
82
+ can: _vitest.vi.fn().mockResolvedValue(true)
83
83
  },
84
84
  parameters: {
85
85
  instance: {
@@ -88,8 +88,8 @@ const mockSdk = (marks)=>{
88
88
  }
89
89
  };
90
90
  };
91
- describe('Toolbar', ()=>{
92
- test('everything on the toolbar should be disabled', async ()=>{
91
+ (0, _vitest.describe)('Toolbar', ()=>{
92
+ (0, _vitest.test)('everything on the toolbar should be disabled', async ()=>{
93
93
  const sdk = mockSdk();
94
94
  const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
95
95
  const { getByTestId } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_platecommon.Plate, {
@@ -102,7 +102,7 @@ describe('Toolbar', ()=>{
102
102
  isDisabled: true
103
103
  })))));
104
104
  await (0, _react1.waitFor)(()=>{
105
- expect(getByTestId('toolbar-heading-toggle')).toBeDisabled();
105
+ (0, _vitest.expect)(getByTestId('toolbar-heading-toggle')).toBeDisabled();
106
106
  [
107
107
  _richtexttypes.MARKS.BOLD,
108
108
  _richtexttypes.MARKS.ITALIC,
@@ -114,12 +114,12 @@ describe('Toolbar', ()=>{
114
114
  'ol',
115
115
  'hr',
116
116
  'table'
117
- ].forEach((s)=>expect(getByTestId(`${s}-toolbar-button`)).toBeDisabled());
118
- expect(getByTestId('toolbar-entity-dropdown-toggle')).toBeDisabled();
117
+ ].forEach((s)=>(0, _vitest.expect)(getByTestId(`${s}-toolbar-button`)).toBeDisabled());
118
+ (0, _vitest.expect)(getByTestId('toolbar-entity-dropdown-toggle')).toBeDisabled();
119
119
  });
120
120
  });
121
- describe('Dropdown', ()=>{
122
- it('always shows whenever at least bold, italic and underline are available', ()=>{
121
+ (0, _vitest.describe)('Dropdown', ()=>{
122
+ (0, _vitest.it)('always shows whenever at least bold, italic and underline are available', ()=>{
123
123
  const sdk = mockSdk([
124
124
  _richtexttypes.MARKS.BOLD,
125
125
  _richtexttypes.MARKS.ITALIC,
@@ -135,9 +135,9 @@ describe('Toolbar', ()=>{
135
135
  }, /*#__PURE__*/ _react.createElement(_index.default, {
136
136
  isDisabled: true
137
137
  })))));
138
- expect(queryByTestId('dropdown-toolbar-button')).toBeVisible();
138
+ (0, _vitest.expect)(queryByTestId('dropdown-toolbar-button')).toBeVisible();
139
139
  });
140
- it('does not show if bold, italic and underline are not available', ()=>{
140
+ (0, _vitest.it)('does not show if bold, italic and underline are not available', ()=>{
141
141
  const sdk = mockSdk([
142
142
  _richtexttypes.MARKS.SUPERSCRIPT,
143
143
  _richtexttypes.MARKS.SUBSCRIPT,
@@ -153,7 +153,7 @@ describe('Toolbar', ()=>{
153
153
  }, /*#__PURE__*/ _react.createElement(_index.default, {
154
154
  isDisabled: true
155
155
  })))));
156
- expect(queryByTestId('dropdown-toolbar-button')).not.toBeInTheDocument();
156
+ (0, _vitest.expect)(queryByTestId('dropdown-toolbar-button')).not.toBeInTheDocument();
157
157
  });
158
158
  });
159
159
  });
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _richtexttypes = require("@contentful/rich-text-types");
6
6
  const _platetestutils = require("@udecode/plate-test-utils");
7
+ const _vitest = require("vitest");
7
8
  const _extractNodes = require("../extractNodes");
8
9
  const createEditor = (children)=>(0, _platetestutils.createEditor)('test-editor', {}, children);
9
10
  const buildParagraph = (children = [])=>({
@@ -66,8 +67,8 @@ const buildList = (type = _richtexttypes.BLOCKS.UL_LIST, secondType = _richtextt
66
67
  }
67
68
  ]
68
69
  });
69
- describe('extractParagraphs', ()=>{
70
- it('table', ()=>{
70
+ (0, _vitest.describe)('extractParagraphs', ()=>{
71
+ (0, _vitest.it)('table', ()=>{
71
72
  const table = {
72
73
  data: {},
73
74
  isVoid: false,
@@ -127,14 +128,14 @@ describe('extractParagraphs', ()=>{
127
128
  const path = [
128
129
  0
129
130
  ];
130
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
131
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
131
132
  paragraph('header 1'),
132
133
  paragraph('header 2'),
133
134
  paragraph('cell 1'),
134
135
  paragraph('cell 2')
135
136
  ]);
136
137
  });
137
- it('blockquote', ()=>{
138
+ (0, _vitest.it)('blockquote', ()=>{
138
139
  const blockquote = {
139
140
  data: {},
140
141
  isVoid: false,
@@ -150,12 +151,12 @@ describe('extractParagraphs', ()=>{
150
151
  const path = [
151
152
  0
152
153
  ];
153
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
154
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
154
155
  paragraph('text 1'),
155
156
  paragraph('text 2')
156
157
  ]);
157
158
  });
158
- it('list - UL', ()=>{
159
+ (0, _vitest.it)('list - UL', ()=>{
159
160
  const ul = buildList(_richtexttypes.BLOCKS.UL_LIST, _richtexttypes.BLOCKS.OL_LIST);
160
161
  const editor = createEditor([
161
162
  ul
@@ -163,13 +164,13 @@ describe('extractParagraphs', ()=>{
163
164
  const path = [
164
165
  0
165
166
  ];
166
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
167
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
167
168
  paragraph('text 1'),
168
169
  paragraph('text 2'),
169
170
  paragraph('text 3')
170
171
  ]);
171
172
  });
172
- it('list - OL', ()=>{
173
+ (0, _vitest.it)('list - OL', ()=>{
173
174
  const ol = buildList(_richtexttypes.BLOCKS.OL_LIST, _richtexttypes.BLOCKS.UL_LIST);
174
175
  const editor = createEditor([
175
176
  ol
@@ -177,13 +178,13 @@ describe('extractParagraphs', ()=>{
177
178
  const path = [
178
179
  0
179
180
  ];
180
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
181
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
181
182
  paragraph('text 1'),
182
183
  paragraph('text 2'),
183
184
  paragraph('text 3')
184
185
  ]);
185
186
  });
186
- it('should preserve marks', ()=>{
187
+ (0, _vitest.it)('should preserve marks', ()=>{
187
188
  const element = {
188
189
  data: {},
189
190
  isVoid: false,
@@ -205,7 +206,7 @@ describe('extractParagraphs', ()=>{
205
206
  const path = [
206
207
  0
207
208
  ];
208
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
209
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
209
210
  paragraph('text 1', {
210
211
  bold: true,
211
212
  italic: true
@@ -216,7 +217,7 @@ describe('extractParagraphs', ()=>{
216
217
  })
217
218
  ]);
218
219
  });
219
- it('should preserve hyperlinks', ()=>{
220
+ (0, _vitest.it)('should preserve hyperlinks', ()=>{
220
221
  const paragraphWithLink = buildParagraph([
221
222
  {
222
223
  text: 'text 1 '
@@ -248,12 +249,12 @@ describe('extractParagraphs', ()=>{
248
249
  const path = [
249
250
  0
250
251
  ];
251
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
252
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
252
253
  paragraphWithLink,
253
254
  paragraph('text 2')
254
255
  ]);
255
256
  });
256
- it('should preserve embedded inline entries', ()=>{
257
+ (0, _vitest.it)('should preserve embedded inline entries', ()=>{
257
258
  const paragraphWithEmbedded = buildParagraph([
258
259
  {
259
260
  text: 'text 1 '
@@ -291,7 +292,7 @@ describe('extractParagraphs', ()=>{
291
292
  const path = [
292
293
  0
293
294
  ];
294
- expect((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
295
+ (0, _vitest.expect)((0, _extractNodes.extractParagraphs)(editor, path)).toEqual([
295
296
  paragraphWithEmbedded,
296
297
  paragraph('text 2')
297
298
  ]);
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _contentfulslatejsadapter = require("@contentful/contentful-slatejs-adapter");
6
+ const _vitest = require("vitest");
6
7
  const _constants = require("../../plugins/CommandPalette/constants");
7
8
  const _testutils = require("../../test-utils");
8
9
  const _removeInternalMarks = require("../removeInternalMarks");
9
- describe('internal mark', ()=>{
10
- describe('First level nodes', ()=>{
10
+ (0, _vitest.describe)('internal mark', ()=>{
11
+ (0, _vitest.describe)('First level nodes', ()=>{
11
12
  const data = [
12
13
  {
13
14
  title: 'Paragraph mark is removed',
@@ -60,8 +61,8 @@ describe('internal mark', ()=>{
60
61
  }
61
62
  ];
62
63
  for (const { input, expected, title } of data){
63
- it(`${title}`, ()=>{
64
- expect((0, _removeInternalMarks.removeInternalMarks)(input)).toEqual(expected);
64
+ (0, _vitest.it)(`${title}`, ()=>{
65
+ (0, _vitest.expect)((0, _removeInternalMarks.removeInternalMarks)(input)).toEqual(expected);
65
66
  });
66
67
  }
67
68
  });
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _richtexttypes = require("@contentful/rich-text-types");
6
+ const _vitest = require("vitest");
6
7
  const _nodeFactory = require("../nodeFactory");
7
8
  const _toSlateDoc = require("../toSlateDoc");
8
- describe('toSlateDoc', ()=>{
9
+ (0, _vitest.describe)('toSlateDoc', ()=>{
9
10
  const cases = [
10
11
  {
11
12
  title: 'undefined documents',
@@ -603,9 +604,9 @@ describe('toSlateDoc', ()=>{
603
604
  }
604
605
  ];
605
606
  cases.forEach(({ title, input, expected })=>{
606
- it(`should normalize ${title}`, ()=>{
607
+ (0, _vitest.it)(`should normalize ${title}`, ()=>{
607
608
  const out = (0, _toSlateDoc.toSlateDoc)(input);
608
- expect(out).toEqual(expected);
609
+ (0, _vitest.expect)(out).toEqual(expected);
609
610
  });
610
611
  });
611
612
  });
@@ -4,21 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
6
6
  const _richtexttypes = require("@contentful/rich-text-types");
7
+ const _vitest = require("vitest");
7
8
  const _validations = require("../validations");
8
- describe('validations', ()=>{
9
- describe('isMarkEnabled', ()=>{
9
+ (0, _vitest.describe)('validations', ()=>{
10
+ (0, _vitest.describe)('isMarkEnabled', ()=>{
10
11
  [
11
12
  _richtexttypes.MARKS.BOLD,
12
13
  _richtexttypes.MARKS.CODE,
13
14
  _richtexttypes.MARKS.ITALIC,
14
15
  _richtexttypes.MARKS.UNDERLINE
15
16
  ].forEach((mark)=>{
16
- it(`returns true for ${mark} mark when no validation explicity set`, ()=>{
17
+ (0, _vitest.it)(`returns true for ${mark} mark when no validation explicity set`, ()=>{
17
18
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)();
18
19
  const actual = (0, _validations.isMarkEnabled)(field, mark);
19
- expect(actual).toBe(true);
20
+ (0, _vitest.expect)(actual).toBe(true);
20
21
  });
21
- it(`returns false for ${mark} mark when validation explicity set without it`, ()=>{
22
+ (0, _vitest.it)(`returns false for ${mark} mark when validation explicity set without it`, ()=>{
22
23
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
23
24
  field.validations = [
24
25
  {
@@ -28,9 +29,9 @@ describe('validations', ()=>{
28
29
  return field;
29
30
  });
30
31
  const actual = (0, _validations.isMarkEnabled)(field, mark);
31
- expect(actual).toBe(false);
32
+ (0, _vitest.expect)(actual).toBe(false);
32
33
  });
33
- it(`returns true for ${mark} mark when validation explicity set with it`, ()=>{
34
+ (0, _vitest.it)(`returns true for ${mark} mark when validation explicity set with it`, ()=>{
34
35
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
35
36
  field.validations = [
36
37
  {
@@ -42,7 +43,7 @@ describe('validations', ()=>{
42
43
  return field;
43
44
  });
44
45
  const actual = (0, _validations.isMarkEnabled)(field, mark);
45
- expect(actual).toBe(true);
46
+ (0, _vitest.expect)(actual).toBe(true);
46
47
  });
47
48
  });
48
49
  });
@@ -2,70 +2,71 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ const _vitest = require("vitest");
5
6
  const _formatDateAndTime = require("./formatDateAndTime");
6
7
  const TODAY = new Date('2024-06-15T12:00:00.000Z');
7
- beforeEach(()=>{
8
- jest.useFakeTimers();
9
- jest.setSystemTime(TODAY);
8
+ (0, _vitest.beforeEach)(()=>{
9
+ _vitest.vi.useFakeTimers();
10
+ _vitest.vi.setSystemTime(TODAY);
10
11
  });
11
- afterEach(()=>{
12
- jest.useRealTimers();
12
+ (0, _vitest.afterEach)(()=>{
13
+ _vitest.vi.useRealTimers();
13
14
  });
14
- describe('formatDate', ()=>{
15
- it('returns "Today" (short) for a date on the same calendar day', ()=>{
16
- expect((0, _formatDateAndTime.formatDate)('2024-06-15T08:00:00.000Z', true)).toBe('Today');
15
+ (0, _vitest.describe)('formatDate', ()=>{
16
+ (0, _vitest.it)('returns "Today" (short) for a date on the same calendar day', ()=>{
17
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-15T08:00:00.000Z', true)).toBe('Today');
17
18
  });
18
- it('returns long form for today', ()=>{
19
- expect((0, _formatDateAndTime.formatDate)('2024-06-15T08:00:00.000Z')).toBe('Today, 15 Jun 2024');
19
+ (0, _vitest.it)('returns long form for today', ()=>{
20
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-15T08:00:00.000Z')).toBe('Today, 15 Jun 2024');
20
21
  });
21
- it('returns "Tomorrow" (short) for the next calendar day', ()=>{
22
- expect((0, _formatDateAndTime.formatDate)('2024-06-16T08:00:00.000Z', true)).toBe('Tomorrow');
22
+ (0, _vitest.it)('returns "Tomorrow" (short) for the next calendar day', ()=>{
23
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-16T08:00:00.000Z', true)).toBe('Tomorrow');
23
24
  });
24
- it('returns long form for tomorrow', ()=>{
25
- expect((0, _formatDateAndTime.formatDate)('2024-06-16T08:00:00.000Z')).toBe('Tomorrow, 16 Jun 2024');
25
+ (0, _vitest.it)('returns long form for tomorrow', ()=>{
26
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-16T08:00:00.000Z')).toBe('Tomorrow, 16 Jun 2024');
26
27
  });
27
- it('returns "Yesterday" (short) for the previous calendar day', ()=>{
28
- expect((0, _formatDateAndTime.formatDate)('2024-06-14T08:00:00.000Z', true)).toBe('Yesterday');
28
+ (0, _vitest.it)('returns "Yesterday" (short) for the previous calendar day', ()=>{
29
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-14T08:00:00.000Z', true)).toBe('Yesterday');
29
30
  });
30
- it('returns long form for yesterday', ()=>{
31
- expect((0, _formatDateAndTime.formatDate)('2024-06-14T08:00:00.000Z')).toBe('Yesterday, 14 Jun 2024');
31
+ (0, _vitest.it)('returns long form for yesterday', ()=>{
32
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-14T08:00:00.000Z')).toBe('Yesterday, 14 Jun 2024');
32
33
  });
33
- it('returns weekday + date for a past date beyond yesterday', ()=>{
34
- expect((0, _formatDateAndTime.formatDate)('2024-06-01T08:00:00.000Z')).toBe('Sat, 01 Jun 2024');
34
+ (0, _vitest.it)('returns weekday + date for a past date beyond yesterday', ()=>{
35
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-01T08:00:00.000Z')).toBe('Sat, 01 Jun 2024');
35
36
  });
36
- it('returns weekday + date for a future date beyond tomorrow', ()=>{
37
- expect((0, _formatDateAndTime.formatDate)('2024-06-20T08:00:00.000Z')).toBe('Thu, 20 Jun 2024');
37
+ (0, _vitest.it)('returns weekday + date for a future date beyond tomorrow', ()=>{
38
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)('2024-06-20T08:00:00.000Z')).toBe('Thu, 20 Jun 2024');
38
39
  });
39
- it('accepts a Date object', ()=>{
40
- expect((0, _formatDateAndTime.formatDate)(new Date('2024-06-15T09:30:00.000Z'), true)).toBe('Today');
40
+ (0, _vitest.it)('accepts a Date object', ()=>{
41
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDate)(new Date('2024-06-15T09:30:00.000Z'), true)).toBe('Today');
41
42
  });
42
43
  });
43
- describe('formatTime', ()=>{
44
- it('formats a UTC ISO string to local h:mm AM/PM', ()=>{
45
- expect((0, _formatDateAndTime.formatTime)('2024-06-15T15:36:45.000Z')).toBe('3:36 PM');
44
+ (0, _vitest.describe)('formatTime', ()=>{
45
+ (0, _vitest.it)('formats a UTC ISO string to local h:mm AM/PM', ()=>{
46
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)('2024-06-15T15:36:45.000Z')).toBe('3:36 PM');
46
47
  });
47
- it('formats midnight UTC correctly', ()=>{
48
- expect((0, _formatDateAndTime.formatTime)('2024-06-15T00:00:00.000Z')).toBe('12:00 AM');
48
+ (0, _vitest.it)('formats midnight UTC correctly', ()=>{
49
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)('2024-06-15T00:00:00.000Z')).toBe('12:00 AM');
49
50
  });
50
- it('formats noon UTC correctly', ()=>{
51
- expect((0, _formatDateAndTime.formatTime)('2024-06-15T12:00:00.000Z')).toBe('12:00 PM');
51
+ (0, _vitest.it)('formats noon UTC correctly', ()=>{
52
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)('2024-06-15T12:00:00.000Z')).toBe('12:00 PM');
52
53
  });
53
- it('timezone shift: two UTC times 1 hour apart produce different outputs', ()=>{
54
- expect((0, _formatDateAndTime.formatTime)('2024-06-15T10:00:00.000Z')).toBe('10:00 AM');
55
- expect((0, _formatDateAndTime.formatTime)('2024-06-15T11:00:00.000Z')).toBe('11:00 AM');
54
+ (0, _vitest.it)('timezone shift: two UTC times 1 hour apart produce different outputs', ()=>{
55
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)('2024-06-15T10:00:00.000Z')).toBe('10:00 AM');
56
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)('2024-06-15T11:00:00.000Z')).toBe('11:00 AM');
56
57
  });
57
- it('accepts a Date object', ()=>{
58
- expect((0, _formatDateAndTime.formatTime)(new Date('2024-06-15T15:36:45.000Z'))).toBe('3:36 PM');
58
+ (0, _vitest.it)('accepts a Date object', ()=>{
59
+ (0, _vitest.expect)((0, _formatDateAndTime.formatTime)(new Date('2024-06-15T15:36:45.000Z'))).toBe('3:36 PM');
59
60
  });
60
61
  });
61
- describe('formatDateAndTime', ()=>{
62
- it('combines date and time with " at " separator', ()=>{
63
- expect((0, _formatDateAndTime.formatDateAndTime)('2024-06-15T15:36:45.000Z')).toBe('Today, 15 Jun 2024 at 3:36 PM');
62
+ (0, _vitest.describe)('formatDateAndTime', ()=>{
63
+ (0, _vitest.it)('combines date and time with " at " separator', ()=>{
64
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDateAndTime)('2024-06-15T15:36:45.000Z')).toBe('Today, 15 Jun 2024 at 3:36 PM');
64
65
  });
65
- it('passes short flag through to date portion', ()=>{
66
- expect((0, _formatDateAndTime.formatDateAndTime)('2024-06-15T15:36:45.000Z', true)).toBe('Today at 3:36 PM');
66
+ (0, _vitest.it)('passes short flag through to date portion', ()=>{
67
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDateAndTime)('2024-06-15T15:36:45.000Z', true)).toBe('Today at 3:36 PM');
67
68
  });
68
- it('works for a past date', ()=>{
69
- expect((0, _formatDateAndTime.formatDateAndTime)('2024-06-01T08:00:00.000Z')).toBe('Sat, 01 Jun 2024 at 8:00 AM');
69
+ (0, _vitest.it)('works for a past date', ()=>{
70
+ (0, _vitest.expect)((0, _formatDateAndTime.formatDateAndTime)('2024-06-01T08:00:00.000Z')).toBe('Sat, 01 Jun 2024 at 8:00 AM');
70
71
  });
71
72
  });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _mitt = /*#__PURE__*/ _interop_require_default(require("mitt"));
6
+ const _vitest = require("vitest");
6
7
  const _sdkNavigatorSlideIn = require("./sdkNavigatorSlideIn");
7
8
  function _interop_require_default(obj) {
8
9
  return obj && obj.__esModule ? obj : {
@@ -45,31 +46,31 @@ function createFakeNavigatorAPI() {
45
46
  navigatorEmitter
46
47
  ];
47
48
  }
48
- describe('watchCurrentSlide().info()', ()=>{
49
+ (0, _vitest.describe)('watchCurrentSlide().info()', ()=>{
49
50
  let fake, slide;
50
- beforeEach(()=>{
51
+ (0, _vitest.beforeEach)(()=>{
51
52
  const fakeNavigator = createFakeNavigatorAPI();
52
53
  const api = fakeNavigator[0];
53
54
  fake = fakeNavigator[1];
54
55
  slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
55
56
  });
56
- it('considers current slide active initially', ()=>{
57
- expect(slide.status()).toEqual({
57
+ (0, _vitest.it)('considers current slide active initially', ()=>{
58
+ (0, _vitest.expect)(slide.status()).toEqual({
58
59
  wasClosed: false,
59
60
  isActive: true
60
61
  });
61
62
  });
62
- it('no longer considers slide active after another slide opens', ()=>{
63
+ (0, _vitest.it)('no longer considers slide active after another slide opens', ()=>{
63
64
  fake.slideIn({
64
65
  oldSlideLevel: 0,
65
66
  newSlideLevel: 1
66
67
  });
67
- expect(slide.status()).toEqual({
68
+ (0, _vitest.expect)(slide.status()).toEqual({
68
69
  wasClosed: false,
69
70
  isActive: false
70
71
  });
71
72
  });
72
- it('considers the original slide active after opening and closing another slide', ()=>{
73
+ (0, _vitest.it)('considers the original slide active after opening and closing another slide', ()=>{
73
74
  fake.slideIn({
74
75
  oldSlideLevel: 0,
75
76
  newSlideLevel: 1
@@ -78,22 +79,22 @@ describe('watchCurrentSlide().info()', ()=>{
78
79
  oldSlideLevel: 1,
79
80
  newSlideLevel: 0
80
81
  });
81
- expect(slide.status()).toEqual({
82
+ (0, _vitest.expect)(slide.status()).toEqual({
82
83
  wasClosed: false,
83
84
  isActive: true
84
85
  });
85
86
  });
86
- it('considers slide closed after jumping to slide below', ()=>{
87
+ (0, _vitest.it)('considers slide closed after jumping to slide below', ()=>{
87
88
  fake.slideIn({
88
89
  oldSlideLevel: 1,
89
90
  newSlideLevel: 0
90
91
  });
91
- expect(slide.status()).toEqual({
92
+ (0, _vitest.expect)(slide.status()).toEqual({
92
93
  wasClosed: true,
93
94
  isActive: false
94
95
  });
95
96
  });
96
- it('still considers slide closed after jumping to slide below and opening a new one', ()=>{
97
+ (0, _vitest.it)('still considers slide closed after jumping to slide below and opening a new one', ()=>{
97
98
  fake.slideIn({
98
99
  oldSlideLevel: 1,
99
100
  newSlideLevel: 0
@@ -102,12 +103,12 @@ describe('watchCurrentSlide().info()', ()=>{
102
103
  oldSlideLevel: 0,
103
104
  newSlideLevel: 1
104
105
  });
105
- expect(slide.status()).toEqual({
106
+ (0, _vitest.expect)(slide.status()).toEqual({
106
107
  wasClosed: true,
107
108
  isActive: false
108
109
  });
109
110
  });
110
- it('considers slide closed after opening new slide and then jumping to slide below', ()=>{
111
+ (0, _vitest.it)('considers slide closed after opening new slide and then jumping to slide below', ()=>{
111
112
  fake.slideIn({
112
113
  oldSlideLevel: 1,
113
114
  newSlideLevel: 2
@@ -116,43 +117,43 @@ describe('watchCurrentSlide().info()', ()=>{
116
117
  oldSlideLevel: 2,
117
118
  newSlideLevel: 0
118
119
  });
119
- expect(slide.status()).toEqual({
120
+ (0, _vitest.expect)(slide.status()).toEqual({
120
121
  wasClosed: true,
121
122
  isActive: false
122
123
  });
123
124
  });
124
125
  });
125
- describe('watchCurrentSlide().onActive()', ()=>{
126
+ (0, _vitest.describe)('watchCurrentSlide().onActive()', ()=>{
126
127
  let api, fake, spy;
127
- beforeEach(()=>{
128
+ (0, _vitest.beforeEach)(()=>{
128
129
  const fakeNavigator = createFakeNavigatorAPI();
129
130
  api = fakeNavigator[0];
130
131
  fake = fakeNavigator[1];
131
- spy = jest.fn();
132
+ spy = _vitest.vi.fn();
132
133
  });
133
- it('fires initially if there was no slide event', ()=>{
134
+ (0, _vitest.it)('fires initially if there was no slide event', ()=>{
134
135
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
135
136
  slide.onActive(spy);
136
- expect(spy).toHaveBeenCalledTimes(1);
137
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
137
138
  });
138
- it('does not fire initially, if new slide already opened, but fires after slide gets closed again', ()=>{
139
+ (0, _vitest.it)('does not fire initially, if new slide already opened, but fires after slide gets closed again', ()=>{
139
140
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
140
141
  fake.slideIn({
141
142
  oldSlideLevel: 2,
142
143
  newSlideLevel: 3
143
144
  });
144
145
  slide.onActive(spy);
145
- expect(spy).toHaveBeenCalledTimes(0);
146
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(0);
146
147
  fake.slideIn({
147
148
  oldSlideLevel: 3,
148
149
  newSlideLevel: 2
149
150
  });
150
- expect(spy).toHaveBeenCalledTimes(1);
151
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
151
152
  });
152
- it('fires every time slide becomes active again', ()=>{
153
+ (0, _vitest.it)('fires every time slide becomes active again', ()=>{
153
154
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
154
155
  slide.onActive(spy);
155
- expect(spy).toHaveBeenCalledTimes(1);
156
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
156
157
  fake.slideIn({
157
158
  oldSlideLevel: 0,
158
159
  newSlideLevel: 1
@@ -161,27 +162,27 @@ describe('watchCurrentSlide().onActive()', ()=>{
161
162
  oldSlideLevel: 1,
162
163
  newSlideLevel: 0
163
164
  });
164
- expect(spy).toHaveBeenCalledTimes(2);
165
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(2);
165
166
  });
166
- it('does not fire on a slide-in event for the same slide we are already on', ()=>{
167
+ (0, _vitest.it)('does not fire on a slide-in event for the same slide we are already on', ()=>{
167
168
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
168
169
  slide.onActive(spy);
169
- expect(spy).toHaveBeenCalledTimes(1);
170
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
170
171
  fake.slideIn({
171
172
  oldSlideLevel: 0,
172
173
  newSlideLevel: 0
173
174
  });
174
- expect(spy).toHaveBeenCalledTimes(1);
175
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(1);
175
176
  });
176
177
  });
177
- describe('watchCurrentSlide().unwatch()', ()=>{
178
+ (0, _vitest.describe)('watchCurrentSlide().unwatch()', ()=>{
178
179
  let api, fake;
179
- beforeEach(()=>{
180
+ (0, _vitest.beforeEach)(()=>{
180
181
  const fakeNavigator = createFakeNavigatorAPI();
181
182
  api = fakeNavigator[0];
182
183
  fake = fakeNavigator[1];
183
184
  });
184
- it('does not update .info() after .unwatch()', ()=>{
185
+ (0, _vitest.it)('does not update .info() after .unwatch()', ()=>{
185
186
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
186
187
  const lastStatus = structuredClone(slide.status());
187
188
  slide.unwatch();
@@ -189,13 +190,13 @@ describe('watchCurrentSlide().unwatch()', ()=>{
189
190
  oldSlideLevel: 1,
190
191
  newSlideLevel: 0
191
192
  });
192
- expect(lastStatus).toEqual(slide.status());
193
+ (0, _vitest.expect)(lastStatus).toEqual(slide.status());
193
194
  });
194
- it('does not fire outstanding onActive after unwatch()', ()=>{
195
+ (0, _vitest.it)('does not fire outstanding onActive after unwatch()', ()=>{
195
196
  const slide = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
196
197
  const slide2 = (0, _sdkNavigatorSlideIn.watchCurrentSlide)(api);
197
- const spy = jest.fn();
198
- const spy2 = jest.fn();
198
+ const spy = _vitest.vi.fn();
199
+ const spy2 = _vitest.vi.fn();
199
200
  fake.slideIn({
200
201
  oldSlideLevel: 0,
201
202
  newSlideLevel: 1
@@ -207,7 +208,7 @@ describe('watchCurrentSlide().unwatch()', ()=>{
207
208
  oldSlideLevel: 1,
208
209
  newSlideLevel: 0
209
210
  });
210
- expect(spy).toHaveBeenCalledTimes(0);
211
- expect(spy2).toHaveBeenCalledTimes(1);
211
+ (0, _vitest.expect)(spy).toHaveBeenCalledTimes(0);
212
+ (0, _vitest.expect)(spy2).toHaveBeenCalledTimes(1);
212
213
  });
213
214
  });
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  const _platebreak = require("@udecode/plate-break");
6
+ const _vitest = require("vitest");
6
7
  const _testutils = require("../../test-utils");
7
8
  const _createExitBreakPlugin = require("./createExitBreakPlugin");
8
- describe('Exit Break', ()=>{
9
- it('derives its config from other plugins', ()=>{
9
+ (0, _vitest.describe)('Exit Break', ()=>{
10
+ (0, _vitest.it)('derives its config from other plugins', ()=>{
10
11
  const input = /*#__PURE__*/ (0, _testutils.jsx)("editor", null, /*#__PURE__*/ (0, _testutils.jsx)("hp", null, /*#__PURE__*/ (0, _testutils.jsx)("htext", null)));
11
12
  const rules = [
12
13
  {
@@ -29,8 +30,8 @@ describe('Exit Break', ()=>{
29
30
  ]
30
31
  });
31
32
  const outPlugin = editor.pluginsByKey[_platebreak.KEY_EXIT_BREAK];
32
- expect(outPlugin.options).toEqual({
33
- rules: expect.arrayContaining(rules)
33
+ (0, _vitest.expect)(outPlugin.options).toEqual({
34
+ rules: _vitest.expect.arrayContaining(rules)
34
35
  });
35
36
  });
36
37
  });