@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
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "assertOutput", {
8
8
  return assertOutput;
9
9
  }
10
10
  });
11
+ const _vitest = require("vitest");
11
12
  const _internal = require("../internal");
12
13
  const _createTestEditor = require("./createTestEditor");
13
14
  const _setEmptyDataAttribute = require("./setEmptyDataAttribute");
@@ -24,8 +25,8 @@ const assertOutput = (options)=>{
24
25
  actualSelection: editor.selection
25
26
  }, null, 2));
26
27
  }
27
- expect(editor.children).toEqual(options.expected.children);
28
+ (0, _vitest.expect)(editor.children).toEqual(options.expected.children);
28
29
  if (options.expected.selection !== null) {
29
- expect(editor.selection).toEqual(options.expected.selection);
30
+ (0, _vitest.expect)(editor.selection).toEqual(options.expected.selection);
30
31
  }
31
32
  };
@@ -8,11 +8,12 @@ Object.defineProperty(exports, "createTestEditor", {
8
8
  return createTestEditor;
9
9
  }
10
10
  });
11
+ const _vitest = require("vitest");
11
12
  const _internal = require("../internal");
12
13
  const _plugins = require("../plugins");
13
14
  const _randomId = require("./randomId");
14
15
  const createTestEditor = (options)=>{
15
- const trackingHandler = options.trackingHandler ?? jest.fn();
16
+ const trackingHandler = options.trackingHandler ?? _vitest.vi.fn();
16
17
  const sdk = options.sdk ?? {
17
18
  field: {
18
19
  validation: []
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { MARKS } from '@contentful/rich-text-types';
3
3
  import { configure, render, waitFor } from '@testing-library/react';
4
4
  import { Plate } from '@udecode/plate-common';
5
- import '@testing-library/jest-dom/extend-expect';
5
+ import { describe, expect, it, test, vi } from 'vitest';
6
6
  import { ContentfulEditorIdProvider, getContentfulEditorId } from '../../ContentfulEditorProvider';
7
7
  import { SdkProvider } from '../../SdkProvider';
8
8
  import Toolbar from '../index';
@@ -15,7 +15,7 @@ const mockSdk = (marks)=>{
15
15
  default: 'en-US'
16
16
  },
17
17
  entry: {
18
- getSys: jest.fn().mockReturnValue({
18
+ getSys: vi.fn().mockReturnValue({
19
19
  id: 'entry-id'
20
20
  })
21
21
  },
@@ -29,7 +29,7 @@ const mockSdk = (marks)=>{
29
29
  ]
30
30
  },
31
31
  access: {
32
- can: jest.fn().mockResolvedValue(true)
32
+ can: vi.fn().mockResolvedValue(true)
33
33
  },
34
34
  parameters: {
35
35
  instance: {
@@ -1,5 +1,6 @@
1
1
  import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
2
  import { createEditor as createSlateEditor } from '@udecode/plate-test-utils';
3
+ import { describe, expect, it } from 'vitest';
3
4
  import { extractParagraphs } from '../extractNodes';
4
5
  const createEditor = (children)=>createSlateEditor('test-editor', {}, children);
5
6
  const buildParagraph = (children = [])=>({
@@ -1,4 +1,5 @@
1
1
  import { toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
2
+ import { describe, expect, it } from 'vitest';
2
3
  import { COMMAND_PROMPT } from '../../plugins/CommandPalette/constants';
3
4
  import { jsx } from '../../test-utils';
4
5
  import { removeInternalMarks } from '../removeInternalMarks';
@@ -1,4 +1,5 @@
1
1
  import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
+ import { describe, expect, it } from 'vitest';
2
3
  import { block, document, inline, text } from '../nodeFactory';
3
4
  import { toSlateDoc } from '../toSlateDoc';
4
5
  describe('toSlateDoc', ()=>{
@@ -1,5 +1,6 @@
1
1
  import { createFakeFieldAPI } from '@contentful/field-editor-test-utils';
2
2
  import { MARKS } from '@contentful/rich-text-types';
3
+ import { describe, expect, it } from 'vitest';
3
4
  import { isMarkEnabled } from '../validations';
4
5
  describe('validations', ()=>{
5
6
  describe('isMarkEnabled', ()=>{
@@ -1,11 +1,12 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
1
2
  import { formatDate, formatDateAndTime, formatTime } from './formatDateAndTime';
2
3
  const TODAY = new Date('2024-06-15T12:00:00.000Z');
3
4
  beforeEach(()=>{
4
- jest.useFakeTimers();
5
- jest.setSystemTime(TODAY);
5
+ vi.useFakeTimers();
6
+ vi.setSystemTime(TODAY);
6
7
  });
7
8
  afterEach(()=>{
8
- jest.useRealTimers();
9
+ vi.useRealTimers();
9
10
  });
10
11
  describe('formatDate', ()=>{
11
12
  it('returns "Today" (short) for a date on the same calendar day', ()=>{
@@ -1,4 +1,5 @@
1
1
  import mitt from 'mitt';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
3
  import { watchCurrentSlide } from './sdkNavigatorSlideIn';
3
4
  if (typeof globalThis.structuredClone !== 'function') {
4
5
  globalThis.structuredClone = (obj)=>{
@@ -119,7 +120,7 @@ describe('watchCurrentSlide().onActive()', ()=>{
119
120
  const fakeNavigator = createFakeNavigatorAPI();
120
121
  api = fakeNavigator[0];
121
122
  fake = fakeNavigator[1];
122
- spy = jest.fn();
123
+ spy = vi.fn();
123
124
  });
124
125
  it('fires initially if there was no slide event', ()=>{
125
126
  const slide = watchCurrentSlide(api);
@@ -185,8 +186,8 @@ describe('watchCurrentSlide().unwatch()', ()=>{
185
186
  it('does not fire outstanding onActive after unwatch()', ()=>{
186
187
  const slide = watchCurrentSlide(api);
187
188
  const slide2 = watchCurrentSlide(api);
188
- const spy = jest.fn();
189
- const spy2 = jest.fn();
189
+ const spy = vi.fn();
190
+ const spy2 = vi.fn();
190
191
  fake.slideIn({
191
192
  oldSlideLevel: 0,
192
193
  newSlideLevel: 1
@@ -1,4 +1,5 @@
1
1
  import { KEY_EXIT_BREAK } from '@udecode/plate-break';
2
+ import { describe, expect, it } from 'vitest';
2
3
  import { jsx, createTestEditor, mockPlugin } from '../../test-utils';
3
4
  import { createExitBreakPlugin } from './createExitBreakPlugin';
4
5
  describe('Exit Break', ()=>{
@@ -1,4 +1,5 @@
1
1
  import { KEY_SOFT_BREAK } from '@udecode/plate-break';
2
+ import { describe, expect, it } from 'vitest';
2
3
  import { jsx, createTestEditor, mockPlugin } from '../../test-utils';
3
4
  import { createSoftBreakPlugin } from './createSoftBreakPlugin';
4
5
  describe('Soft Break', ()=>{
@@ -1,7 +1,8 @@
1
- import { jsx } from '../../test-utils';
1
+ import { toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
2
2
  import { documentToPlainTextString } from '@contentful/rich-text-plain-text-renderer';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { jsx } from '../../test-utils';
3
5
  import { getTextContent } from './utils';
4
- import { toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
5
6
  describe('getTextContent', ()=>{
6
7
  const cases = [
7
8
  {
@@ -1,19 +1,21 @@
1
+ import { afterEach, describe, expect, test, vi } from 'vitest';
1
2
  import * as internal from '../../internal/transforms';
2
3
  import { createTestEditor } from '../../test-utils';
3
4
  import { COMMAND_PROMPT } from './constants';
4
5
  import { createOnKeyDown } from './onKeyDown';
5
- jest.mock('../../internal/transforms', ()=>{
6
+ vi.mock('../../internal/transforms', async ()=>{
7
+ const actual = await vi.importActual('../../internal/transforms');
6
8
  return {
7
9
  __esModule: true,
8
- ...jest.requireActual('../../internal/transforms')
10
+ ...actual
9
11
  };
10
12
  });
11
13
  describe('onKeyDown', ()=>{
12
14
  const { editor } = createTestEditor({});
13
- const addMark = jest.spyOn(internal, 'addMark');
14
- const onCommandPaletteAction = jest.spyOn(editor.tracking, 'onCommandPaletteAction');
15
+ const addMark = vi.spyOn(internal, 'addMark');
16
+ const onCommandPaletteAction = vi.spyOn(editor.tracking, 'onCommandPaletteAction');
15
17
  afterEach(()=>{
16
- jest.resetAllMocks();
18
+ vi.resetAllMocks();
17
19
  });
18
20
  test.each`
19
21
  layout | key
@@ -1,11 +1,13 @@
1
1
  import { BLOCKS } from '@contentful/rich-text-types';
2
2
  import { createEditor as createSlateEditor } from '@udecode/plate-test-utils';
3
+ import { describe, expect, it, vi } from 'vitest';
3
4
  import { insertBlock } from './insertBlock';
4
- jest.mock('../../../helpers/editor', ()=>{
5
+ vi.mock('../../../helpers/editor', async ()=>{
6
+ const actual = await vi.importActual('../../../helpers/editor');
5
7
  return {
6
8
  __esModule: true,
7
- ...jest.requireActual('../../../helpers/editor'),
8
- focus: jest.fn()
9
+ ...actual,
10
+ focus: vi.fn()
9
11
  };
10
12
  });
11
13
  describe('CommandPalette insertBlock', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  it('can contain inline entries & hyperlinks', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  it('removes empty links from the document structure', ()=>{
@@ -1,6 +1,7 @@
1
+ import { describe, expect, it, vi } from 'vitest';
1
2
  describe('HyperlinkModal recommendations.searchQuery feature', ()=>{
2
3
  it('should pass linkText as searchQuery to selectSingleEntry', ()=>{
3
- const mockSelectSingleEntry = jest.fn();
4
+ const mockSelectSingleEntry = vi.fn();
4
5
  const linkText = 'example search text';
5
6
  const expectedOptions = {
6
7
  locale: 'en-US',
@@ -20,7 +21,7 @@ describe('HyperlinkModal recommendations.searchQuery feature', ()=>{
20
21
  }));
21
22
  });
22
23
  it('should update searchQuery when linkText changes', ()=>{
23
- const mockSelectSingleEntry = jest.fn();
24
+ const mockSelectSingleEntry = vi.fn();
24
25
  const modifiedText = 'modified text';
25
26
  const expectedOptions = {
26
27
  locale: 'en-US',
@@ -39,7 +40,7 @@ describe('HyperlinkModal recommendations.searchQuery feature', ()=>{
39
40
  }));
40
41
  });
41
42
  it('should handle empty linkText', ()=>{
42
- const mockSelectSingleEntry = jest.fn();
43
+ const mockSelectSingleEntry = vi.fn();
43
44
  const expectedOptions = {
44
45
  locale: 'en-US',
45
46
  contentTypes: [
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  it('wraps orphaned list items in a list', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, test } from 'vitest';
1
2
  import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
3
  describe('insert line break', ()=>{
3
4
  const tests = [
@@ -1,3 +1,4 @@
1
+ import { describe, test } from 'vitest';
1
2
  import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
3
  describe('insert fragment', ()=>{
3
4
  const tests = [
@@ -1,3 +1,4 @@
1
+ import { describe, test } from 'vitest';
1
2
  import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
3
  import { moveListItems } from './moveListItems';
3
4
  describe('moving list items (up/down)', ()=>{
@@ -1,4 +1,5 @@
1
1
  import { BLOCKS } from '@contentful/rich-text-types';
2
+ import { describe, it } from 'vitest';
2
3
  import { assertOutput, jsx, createTestEditor } from '../../../test-utils';
3
4
  import { toggleList } from './toggleList';
4
5
  describe('toggle on', ()=>{
@@ -1,4 +1,5 @@
1
1
  import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
+ import { beforeEach, describe, expect, it } from 'vitest';
2
3
  import { transformWrapIn } from '../../helpers/transformers';
3
4
  import { jsx, createTestEditor, mockPlugin, assertOutput } from '../../test-utils';
4
5
  import { createNormalizerPlugin } from './createNormalizerPlugin';
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  it('can contain inline entries & hyperlinks', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import { sanitizeHTML } from '../sanitizeHTML';
2
3
  describe('HTML Sanitization', ()=>{
3
4
  it('removes unsupported elements from <a>', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  it('can contain inline entries & hyperlinks', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, it } from 'vitest';
1
2
  import { assertOutput, jsx } from '../../../test-utils';
2
3
  describe('normalization', ()=>{
3
4
  describe('Table', ()=>{
@@ -1,3 +1,4 @@
1
+ import { test } from 'vitest';
1
2
  import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
3
  import { insertTableAndFocusFirstCell } from '../helpers';
3
4
  test('insertTableAndFocusFirstCell', ()=>{
@@ -1,3 +1,4 @@
1
+ import { describe, test } from 'vitest';
1
2
  import { jsx, assertOutput, createTestEditor } from '../../../test-utils';
2
3
  describe('delete backward', ()=>{
3
4
  const tests = [
@@ -1,11 +1,13 @@
1
1
  import { BLOCKS } from '@contentful/rich-text-types';
2
2
  import { createEditor as createSlateEditor } from '@udecode/plate-test-utils';
3
+ import { describe, expect, it, vi } from 'vitest';
3
4
  import { selectEntityAndInsert } from '../EmbeddedBlockUtil';
4
- jest.mock('../../../helpers/editor', ()=>{
5
+ vi.mock('../../../helpers/editor', async ()=>{
6
+ const actual = await vi.importActual('../../../helpers/editor');
5
7
  return {
6
8
  __esModule: true,
7
- ...jest.requireActual('../../../helpers/editor'),
8
- focus: jest.fn()
9
+ ...actual,
10
+ focus: vi.fn()
9
11
  };
10
12
  });
11
13
  describe('EmbeddedBlockUtil selectEntityAndInsert', ()=>{
@@ -44,7 +46,7 @@ describe('EmbeddedBlockUtil selectEntityAndInsert', ()=>{
44
46
  validations: []
45
47
  },
46
48
  dialogs: {
47
- selectSingleEntry: jest.fn(async ()=>({
49
+ selectSingleEntry: vi.fn(async ()=>({
48
50
  sys: {
49
51
  id: 'entry-1',
50
52
  type: 'Entry'
@@ -52,10 +54,10 @@ describe('EmbeddedBlockUtil selectEntityAndInsert', ()=>{
52
54
  }))
53
55
  },
54
56
  navigator: {
55
- onSlideInNavigation: jest.fn(()=>()=>{})
57
+ onSlideInNavigation: vi.fn(()=>()=>{})
56
58
  }
57
59
  };
58
- const logAction = jest.fn();
60
+ const logAction = vi.fn();
59
61
  await selectEntityAndInsert(BLOCKS.EMBEDDED_ENTRY, sdk, editor, logAction);
60
62
  expect(editor.children.some((n)=>n.type === BLOCKS.EMBEDDED_ENTRY)).toBe(true);
61
63
  });
@@ -112,7 +114,7 @@ describe('EmbeddedBlockUtil selectEntityAndInsert', ()=>{
112
114
  validations: []
113
115
  },
114
116
  dialogs: {
115
- selectSingleEntry: jest.fn(async ()=>({
117
+ selectSingleEntry: vi.fn(async ()=>({
116
118
  sys: {
117
119
  id: 'entry-1',
118
120
  type: 'Entry'
@@ -120,10 +122,10 @@ describe('EmbeddedBlockUtil selectEntityAndInsert', ()=>{
120
122
  }))
121
123
  },
122
124
  navigator: {
123
- onSlideInNavigation: jest.fn(()=>()=>{})
125
+ onSlideInNavigation: vi.fn(()=>()=>{})
124
126
  }
125
127
  };
126
- const logAction = jest.fn();
128
+ const logAction = vi.fn();
127
129
  await selectEntityAndInsert(BLOCKS.EMBEDDED_ENTRY, sdk, editor, logAction);
128
130
  const containsType = (node, type)=>{
129
131
  if (!node) return false;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { EntityProvider } from '@contentful/field-editor-reference';
3
- import '@testing-library/jest-dom/extend-expect';
4
3
  import { configure, fireEvent, render, waitFor } from '@testing-library/react';
4
+ import { beforeEach, expect, test, vi } from 'vitest';
5
5
  import publishedAsset from '../__fixtures__/published_asset.json';
6
6
  import { FetchingWrappedAssetCard } from '../FetchingWrappedAssetCard';
7
7
  configure({
@@ -21,20 +21,20 @@ beforeEach(()=>{
21
21
  },
22
22
  cma: {
23
23
  asset: {
24
- get: jest.fn().mockResolvedValue(publishedAsset)
24
+ get: vi.fn().mockResolvedValue(publishedAsset)
25
25
  },
26
26
  scheduledAction: {
27
- getMany: jest.fn().mockResolvedValue({
27
+ getMany: vi.fn().mockResolvedValue({
28
28
  items: [],
29
29
  total: 0
30
30
  })
31
31
  }
32
32
  },
33
33
  space: {
34
- getEntityScheduledActions: jest.fn().mockResolvedValue([])
34
+ getEntityScheduledActions: vi.fn().mockResolvedValue([])
35
35
  },
36
36
  navigator: {
37
- onSlideInNavigation: jest.fn()
37
+ onSlideInNavigation: vi.fn()
38
38
  },
39
39
  ids: {
40
40
  space: 'space-id',
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { EntityProvider } from '@contentful/field-editor-reference';
3
- import '@testing-library/jest-dom/extend-expect';
4
3
  import { configure, fireEvent, render, waitFor } from '@testing-library/react';
4
+ import { beforeEach, expect, test, vi } from 'vitest';
5
5
  import publishedCT from '../__fixtures__/published_content_type.json';
6
6
  import publishedEntry from '../__fixtures__/published_entry.json';
7
7
  import { FetchingWrappedEntryCard } from '../FetchingWrappedEntryCard';
@@ -22,23 +22,23 @@ beforeEach(()=>{
22
22
  },
23
23
  cma: {
24
24
  entry: {
25
- get: jest.fn().mockResolvedValue(publishedEntry)
25
+ get: vi.fn().mockResolvedValue(publishedEntry)
26
26
  },
27
27
  scheduledAction: {
28
- getMany: jest.fn().mockResolvedValue({
28
+ getMany: vi.fn().mockResolvedValue({
29
29
  items: [],
30
30
  total: 0
31
31
  })
32
32
  },
33
33
  contentType: {
34
- get: jest.fn().mockResolvedValue(publishedCT)
34
+ get: vi.fn().mockResolvedValue(publishedCT)
35
35
  }
36
36
  },
37
37
  space: {
38
- getEntityScheduledActions: jest.fn().mockResolvedValue([])
38
+ getEntityScheduledActions: vi.fn().mockResolvedValue([])
39
39
  },
40
40
  navigator: {
41
- onSlideInNavigation: jest.fn()
41
+ onSlideInNavigation: vi.fn()
42
42
  },
43
43
  ids: {
44
44
  space: 'space-id',
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import '@testing-library/jest-dom/extend-expect';
3
2
  import { EntityProvider } from '@contentful/field-editor-reference';
4
3
  import { SharedQueryClientProvider } from '@contentful/field-editor-shared/react-query';
5
4
  import { createTestQueryClient } from '@contentful/field-editor-test-utils';
6
5
  import { configure, render, waitFor } from '@testing-library/react';
6
+ import { beforeEach, expect, test, vi } from 'vitest';
7
7
  import publishedCT from '../__fixtures__/published_content_type.json';
8
8
  import publishedEntry from '../__fixtures__/published_entry.json';
9
9
  import space from '../__fixtures__/space.json';
@@ -27,10 +27,10 @@ beforeEach(()=>{
27
27
  },
28
28
  cma: {
29
29
  contentType: {
30
- get: jest.fn().mockReturnValue(publishedCT)
30
+ get: vi.fn().mockReturnValue(publishedCT)
31
31
  },
32
32
  entry: {
33
- get: jest.fn().mockImplementation(({ entryId })=>{
33
+ get: vi.fn().mockImplementation(({ entryId })=>{
34
34
  if (entryId === 'linked-entry-urn') {
35
35
  return Promise.resolve(publishedEntry);
36
36
  }
@@ -38,7 +38,7 @@ beforeEach(()=>{
38
38
  })
39
39
  },
40
40
  locale: {
41
- getMany: jest.fn().mockResolvedValue({
41
+ getMany: vi.fn().mockResolvedValue({
42
42
  items: [
43
43
  {
44
44
  default: true,
@@ -48,17 +48,17 @@ beforeEach(()=>{
48
48
  })
49
49
  },
50
50
  scheduledAction: {
51
- getMany: jest.fn().mockResolvedValue({
51
+ getMany: vi.fn().mockResolvedValue({
52
52
  items: [],
53
53
  total: 0
54
54
  })
55
55
  },
56
56
  space: {
57
- get: jest.fn().mockResolvedValue(space)
57
+ get: vi.fn().mockResolvedValue(space)
58
58
  }
59
59
  },
60
60
  space: {
61
- onEntityChanged: jest.fn()
61
+ onEntityChanged: vi.fn()
62
62
  },
63
63
  navigator: {},
64
64
  ids: {
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { normalize } from '../internal';
2
3
  import { createTestEditor } from './createTestEditor';
3
4
  import { setEmptyDataAttribute } from './setEmptyDataAttribute';
@@ -1,8 +1,9 @@
1
+ import { vi } from 'vitest';
1
2
  import { normalize, createPlateEditor } from '../internal';
2
3
  import { getPlugins } from '../plugins';
3
4
  import { randomId } from './randomId';
4
5
  export const createTestEditor = (options)=>{
5
- const trackingHandler = options.trackingHandler ?? jest.fn();
6
+ const trackingHandler = options.trackingHandler ?? vi.fn();
6
7
  const sdk = options.sdk ?? {
7
8
  field: {
8
9
  validation: []
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ export {};
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ export {};
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ export {};
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "6.3.7",
3
+ "version": "6.3.8",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -32,8 +32,8 @@
32
32
  "build:types": "tsc --outDir dist/types --emitDeclarationOnly",
33
33
  "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs",
34
34
  "build:esm": "swc src --config-file ../../.swcrc -d dist/esm",
35
- "test": "jest --watch",
36
- "test:ci": "jest --ci --passWithNoTests",
35
+ "test": "vitest",
36
+ "test:ci": "vitest run",
37
37
  "tsc": "tsc -p ./ --noEmit",
38
38
  "lint": "eslint ./src --ext .js,.jsx,.ts,.tsx"
39
39
  },
@@ -45,8 +45,8 @@
45
45
  "@contentful/f36-icons": "^6.7.1",
46
46
  "@contentful/f36-tokens": "^6.1.2",
47
47
  "@contentful/f36-utils": "^6.1.0",
48
- "@contentful/field-editor-reference": "^8.3.1",
49
- "@contentful/field-editor-shared": "^4.4.0",
48
+ "@contentful/field-editor-reference": "^8.3.2",
49
+ "@contentful/field-editor-shared": "^4.4.1",
50
50
  "@contentful/rich-text-plain-text-renderer": "^17.0.0",
51
51
  "@contentful/rich-text-types": "^17.2.5",
52
52
  "@emotion/css": "^11.13.5",
@@ -83,7 +83,7 @@
83
83
  "react-dom": ">=18.3.1"
84
84
  },
85
85
  "devDependencies": {
86
- "@contentful/field-editor-test-utils": "^3.1.0",
86
+ "@contentful/field-editor-test-utils": "^3.1.1",
87
87
  "@contentful/rich-text-react-renderer": "^16.0.0",
88
88
  "@lingui/core": "5.3.0",
89
89
  "@types/is-hotkey": "^0.1.6",
@@ -94,5 +94,5 @@
94
94
  "publishConfig": {
95
95
  "registry": "https://npm.pkg.github.com/"
96
96
  },
97
- "gitHead": "51e5084138bc25e32e9455a83af6ce230323ce8d"
97
+ "gitHead": "5fb6c32d2590e72e56a53cb180a155f84d6505d9"
98
98
  }