@atlaskit/editor-plugin-table 7.2.2 → 7.3.0

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 (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/commands/column-resize.js +115 -45
  3. package/dist/cjs/commands/go-to-next-cell.js +7 -11
  4. package/dist/cjs/commands/misc.js +3 -2
  5. package/dist/cjs/commands/selection.js +3 -3
  6. package/dist/cjs/event-handlers.js +38 -25
  7. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
  8. package/dist/cjs/pm-plugins/keymap.js +1 -0
  9. package/dist/cjs/pm-plugins/main.js +43 -9
  10. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
  11. package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
  12. package/dist/cjs/reducer.js +5 -2
  13. package/dist/cjs/utils/drag-menu.js +37 -23
  14. package/dist/cjs/utils/merged-cells.js +66 -1
  15. package/dist/es2019/commands/column-resize.js +100 -35
  16. package/dist/es2019/commands/go-to-next-cell.js +7 -9
  17. package/dist/es2019/commands/misc.js +3 -2
  18. package/dist/es2019/commands/selection.js +5 -5
  19. package/dist/es2019/event-handlers.js +17 -3
  20. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  21. package/dist/es2019/pm-plugins/keymap.js +3 -2
  22. package/dist/es2019/pm-plugins/main.js +41 -5
  23. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
  24. package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
  25. package/dist/es2019/reducer.js +5 -2
  26. package/dist/es2019/utils/drag-menu.js +38 -14
  27. package/dist/es2019/utils/merged-cells.js +73 -0
  28. package/dist/esm/commands/column-resize.js +105 -35
  29. package/dist/esm/commands/go-to-next-cell.js +7 -11
  30. package/dist/esm/commands/misc.js +3 -2
  31. package/dist/esm/commands/selection.js +5 -5
  32. package/dist/esm/event-handlers.js +38 -25
  33. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  34. package/dist/esm/pm-plugins/keymap.js +3 -2
  35. package/dist/esm/pm-plugins/main.js +38 -4
  36. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
  37. package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
  38. package/dist/esm/reducer.js +5 -2
  39. package/dist/esm/utils/drag-menu.js +36 -22
  40. package/dist/esm/utils/merged-cells.js +65 -0
  41. package/dist/types/commands/column-resize.d.ts +2 -0
  42. package/dist/types/commands/misc.d.ts +1 -1
  43. package/dist/types/types.d.ts +16 -0
  44. package/dist/types/utils/drag-menu.d.ts +4 -1
  45. package/dist/types/utils/merged-cells.d.ts +2 -0
  46. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
  47. package/dist/types-ts4.5/commands/misc.d.ts +1 -1
  48. package/dist/types-ts4.5/types.d.ts +16 -0
  49. package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
  50. package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
  51. package/package.json +10 -17
  52. package/src/commands/column-resize.ts +155 -40
  53. package/src/commands/go-to-next-cell.ts +6 -15
  54. package/src/commands/misc.ts +2 -0
  55. package/src/commands/selection.ts +5 -5
  56. package/src/event-handlers.ts +21 -4
  57. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
  58. package/src/pm-plugins/keymap.ts +3 -0
  59. package/src/pm-plugins/main.ts +47 -2
  60. package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
  61. package/src/pm-plugins/table-resizing/plugin.ts +18 -1
  62. package/src/reducer.ts +5 -2
  63. package/src/types.ts +16 -0
  64. package/src/utils/drag-menu.ts +94 -20
  65. package/src/utils/merged-cells.ts +78 -0
  66. package/tsconfig.dev.json +0 -69
  67. package/tsconfig.json +2 -877
  68. package/examples/99-testing.tsx +0 -140
  69. package/examples/config.jsonc +0 -14
  70. package/src/__tests__/unit/analytics.ts +0 -888
  71. package/src/__tests__/unit/collab.ts +0 -93
  72. package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
  73. package/src/__tests__/unit/commands/insert.ts +0 -137
  74. package/src/__tests__/unit/commands/misc.ts +0 -185
  75. package/src/__tests__/unit/commands/sort.ts +0 -128
  76. package/src/__tests__/unit/commands.ts +0 -745
  77. package/src/__tests__/unit/copy-button.ts +0 -22
  78. package/src/__tests__/unit/copy-paste.ts +0 -677
  79. package/src/__tests__/unit/event-handlers/index.ts +0 -125
  80. package/src/__tests__/unit/event-handlers.ts +0 -296
  81. package/src/__tests__/unit/fix-tables.ts +0 -164
  82. package/src/__tests__/unit/get-toolbar-config.ts +0 -127
  83. package/src/__tests__/unit/handlers.ts +0 -98
  84. package/src/__tests__/unit/hover-selection.ts +0 -230
  85. package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
  86. package/src/__tests__/unit/index.ts +0 -912
  87. package/src/__tests__/unit/layout.ts +0 -146
  88. package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
  89. package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
  90. package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
  91. package/src/__tests__/unit/nodeviews/cell.ts +0 -132
  92. package/src/__tests__/unit/nodeviews/table.ts +0 -129
  93. package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
  94. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
  95. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
  96. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
  97. package/src/__tests__/unit/pm-plugins/main.ts +0 -214
  98. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
  99. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
  100. package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
  101. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
  102. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
  103. package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
  104. package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
  105. package/src/__tests__/unit/sort-column.ts +0 -399
  106. package/src/__tests__/unit/toolbar.ts +0 -512
  107. package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
  108. package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
  109. package/src/__tests__/unit/transforms/merging.ts +0 -392
  110. package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
  111. package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
  112. package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
  113. package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
  114. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
  115. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
  116. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
  117. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
  118. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
  119. package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
  120. package/src/__tests__/unit/ui/RowControls.tsx +0 -294
  121. package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
  122. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
  123. package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
  124. package/src/__tests__/unit/undo-redo.ts +0 -220
  125. package/src/__tests__/unit/utils/analytics.ts +0 -98
  126. package/src/__tests__/unit/utils/collapse.ts +0 -57
  127. package/src/__tests__/unit/utils/column-controls.ts +0 -205
  128. package/src/__tests__/unit/utils/dom.ts +0 -180
  129. package/src/__tests__/unit/utils/merged-cells.ts +0 -156
  130. package/src/__tests__/unit/utils/nodes.ts +0 -79
  131. package/src/__tests__/unit/utils/row-controls.ts +0 -195
  132. package/src/__tests__/unit/utils/table.ts +0 -96
  133. package/src/__tests__/unit/utils.ts +0 -670
  134. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
  135. package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
  136. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -3
  137. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -3
  138. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -3
  139. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -3
  140. package/src/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -3
  141. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -3
  142. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -3
  143. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -3
  144. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
  145. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
  146. package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
  147. package/src/__tests__/visual-regression/copy-button.ts +0 -181
  148. package/src/__tests__/visual-regression/index.ts +0 -62
  149. package/src/__tests__/visual-regression/sticky-header.ts +0 -61
@@ -1,511 +0,0 @@
1
- import React from 'react';
2
-
3
- import { render, screen } from '@testing-library/react';
4
- import { IntlProvider } from 'react-intl-next';
5
-
6
- import { ReactEditorViewContext } from '@atlaskit/editor-common/ui-react';
7
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
8
- import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
9
- import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
10
- import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
11
- import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
12
- import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
13
- import { widthPlugin } from '@atlaskit/editor-plugin-width';
14
- import * as prosemirrorUtils from '@atlaskit/editor-prosemirror/utils';
15
- import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
16
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
17
- // eslint-disable-next-line import/no-extraneous-dependencies
18
- import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
19
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
20
- import {
21
- createProsemirrorEditorFactory,
22
- Preset,
23
- } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
24
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
25
- import {
26
- doc,
27
- p,
28
- table,
29
- tdCursor,
30
- tdEmpty,
31
- th,
32
- tr,
33
- } from '@atlaskit/editor-test-helpers/doc-builder';
34
- import { ffTest } from '@atlassian/feature-flags-test-utils';
35
-
36
- import tablePlugin from '../../../plugin';
37
- import DragMenu from '../../../ui/FloatingDragMenu/DragMenu';
38
-
39
- describe('FloatingDragMenu', () => {
40
- const createEditor = createProsemirrorEditorFactory();
41
- let editorView: EditorView;
42
- let tableNode: ContentNodeWithPos | undefined;
43
- beforeEach(() => {
44
- ({ editorView } = createEditor({
45
- doc: doc(table()(tr(th()(p('')), th()(p(''))), tr(tdCursor, tdEmpty))),
46
- preset: new Preset<LightEditorPlugin>()
47
- .add([featureFlagsPlugin, {}])
48
- .add([analyticsPlugin, {}])
49
- .add(contentInsertionPlugin)
50
- .add(widthPlugin)
51
- .add(guidelinePlugin)
52
- .add(selectionPlugin)
53
- .add(tablePlugin),
54
- }));
55
-
56
- tableNode = prosemirrorUtils.findParentNodeOfTypeClosestToPos(
57
- editorView.state.selection.$from,
58
- editorView.state.schema.nodes.table,
59
- );
60
- });
61
- describe('should group the menu items correctly', () => {
62
- ffTest(
63
- 'platform.editor.menu.group-items',
64
- () => {
65
- // Run test case when FF platform.editor..menu.group-items is true
66
- const tableRef = editorView.dom.querySelector('table');
67
- const editorRef = {
68
- current: document.createElement('div'),
69
- };
70
- render(
71
- <ReactEditorViewContext.Provider
72
- value={{
73
- editorRef,
74
- }}
75
- >
76
- {' '}
77
- <IntlProvider locale="en">
78
- <DragMenu
79
- editorView={editorView}
80
- isOpen={true}
81
- getEditorContainerWidth={jest.fn()}
82
- tableRef={tableRef as HTMLTableElement}
83
- tableNode={tableNode?.node}
84
- direction="row"
85
- />
86
- </IntlProvider>
87
- </ReactEditorViewContext.Provider>,
88
- );
89
- expect(screen.getAllByRole('menu')).toHaveLength(1);
90
- expect(screen.getAllByRole('group')).toHaveLength(2);
91
- },
92
- () => {
93
- // Run test case when FF platform.editor..menu.group-items is false
94
- const tableRef = editorView.dom.querySelector('table');
95
- const editorRef = {
96
- current: document.createElement('div'),
97
- };
98
- render(
99
- <ReactEditorViewContext.Provider
100
- value={{
101
- editorRef,
102
- }}
103
- >
104
- <IntlProvider locale="en">
105
- <DragMenu
106
- editorView={editorView}
107
- isOpen={true}
108
- getEditorContainerWidth={jest.fn()}
109
- tableRef={tableRef as HTMLTableElement}
110
- tableNode={tableNode?.node}
111
- direction="row"
112
- />
113
- </IntlProvider>
114
- </ReactEditorViewContext.Provider>,
115
- );
116
- expect(screen.getAllByRole('menu')).toHaveLength(2);
117
- expect(screen.queryByRole('group')).toBeNull();
118
- },
119
- );
120
- });
121
- describe('menu items', () => {
122
- it('should render the right menu items for row', () => {
123
- // Run test case when FF platform.editor..menu.group-items is true
124
- const tableRef = editorView.dom.querySelector('table');
125
- const editorRef = {
126
- current: document.createElement('div'),
127
- };
128
- render(
129
- <ReactEditorViewContext.Provider
130
- value={{
131
- editorRef,
132
- }}
133
- >
134
- <div id="drag-handle-button-row">dragmenu anchor</div>
135
- <IntlProvider locale="en">
136
- <DragMenu
137
- editorView={editorView}
138
- isOpen={true}
139
- getEditorContainerWidth={jest.fn()}
140
- tableRef={tableRef as HTMLTableElement}
141
- tableNode={tableNode?.node}
142
- direction="row"
143
- />
144
- </IntlProvider>
145
- </ReactEditorViewContext.Provider>,
146
- );
147
-
148
- const items = screen.getAllByRole('menuitem');
149
- const menuitemTextArray = items.map((item) => item.textContent);
150
- expect(menuitemTextArray).toMatchInlineSnapshot(`
151
- Array [
152
- "Add row aboveCtrl+Alt+↑",
153
- "Add row belowCtrl+Alt+↓",
154
- "Clear cell⌫",
155
- "Delete rowCtrl+⌫",
156
- "Move row upCtrl+Alt+Shift+↑",
157
- "Move row downCtrl+Alt+Shift+↓",
158
- ]
159
- `);
160
- });
161
- it('should render the right menu items for column', () => {
162
- const tableRef = editorView.dom.querySelector('table');
163
- const editorRef = {
164
- current: document.createElement('div'),
165
- };
166
- render(
167
- <ReactEditorViewContext.Provider
168
- value={{
169
- editorRef,
170
- }}
171
- >
172
- <IntlProvider locale="en">
173
- <DragMenu
174
- editorView={editorView}
175
- isOpen={true}
176
- getEditorContainerWidth={jest.fn()}
177
- tableRef={tableRef as HTMLTableElement}
178
- tableNode={tableNode?.node}
179
- direction="column"
180
- />
181
- </IntlProvider>
182
- </ReactEditorViewContext.Provider>,
183
- );
184
-
185
- const items = screen.getAllByRole('menuitem');
186
- const menuitemTextArray = items.map((item) => item.textContent);
187
- expect(menuitemTextArray).toMatchInlineSnapshot(`
188
- Array [
189
- "Add column leftCtrl+Alt+←",
190
- "Add column rightCtrl+Alt+→",
191
- "Distribute columns",
192
- "Clear cell⌫",
193
- "Delete columnCtrl+⌫",
194
- "Move column leftCtrl+Alt+Shift+←",
195
- "Move column rightCtrl+Alt+Shift+→",
196
- "Sort increasing",
197
- "Sort decreasing",
198
- ]
199
- `);
200
- });
201
- // first row menu item check
202
- ffTest(
203
- 'platform.editor.table.new-cell-context-menu-styling',
204
- () => {
205
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
206
-
207
- const tableRef = editorView.dom.querySelector('table');
208
- const editorRef = {
209
- current: document.createElement('div'),
210
- };
211
- render(
212
- <ReactEditorViewContext.Provider
213
- value={{
214
- editorRef,
215
- }}
216
- >
217
- <div id="drag-handle-button-row">dragmenu anchor</div>
218
- <IntlProvider locale="en">
219
- <DragMenu
220
- editorView={editorView}
221
- isOpen={true}
222
- getEditorContainerWidth={jest.fn()}
223
- tableRef={tableRef as HTMLTableElement}
224
- tableNode={tableNode?.node}
225
- direction="row"
226
- index={0}
227
- />
228
- </IntlProvider>
229
- </ReactEditorViewContext.Provider>,
230
- );
231
-
232
- const items = screen.getAllByRole('menuitem');
233
- const menuitemTextArray = items.map((item) => item.textContent);
234
- expect(menuitemTextArray).toMatchInlineSnapshot(`
235
- Array [
236
- "Add row aboveCtrl+Alt+↑",
237
- "Add row belowCtrl+Alt+↓",
238
- "Clear cell⌫",
239
- "Delete rowCtrl+⌫",
240
- "Move row upCtrl+Alt+Shift+↑",
241
- "Move row downCtrl+Alt+Shift+↓",
242
- "Header row",
243
- "Row numbers",
244
- ]
245
- `);
246
- },
247
- () => {
248
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
249
- const tableRef = editorView.dom.querySelector('table');
250
- const editorRef = {
251
- current: document.createElement('div'),
252
- };
253
- render(
254
- <ReactEditorViewContext.Provider
255
- value={{
256
- editorRef,
257
- }}
258
- >
259
- <div id="drag-handle-button-row">dragmenu anchor</div>
260
- <IntlProvider locale="en">
261
- <DragMenu
262
- editorView={editorView}
263
- isOpen={true}
264
- getEditorContainerWidth={jest.fn()}
265
- tableRef={tableRef as HTMLTableElement}
266
- tableNode={tableNode?.node}
267
- direction="row"
268
- index={0}
269
- />
270
- </IntlProvider>
271
- </ReactEditorViewContext.Provider>,
272
- );
273
-
274
- const items = screen.getAllByRole('menuitem');
275
- const menuitemTextArray = items.map((item) => item.textContent);
276
- expect(menuitemTextArray).toMatchInlineSnapshot(`
277
- Array [
278
- "Add row aboveCtrl+Alt+↑",
279
- "Add row belowCtrl+Alt+↓",
280
- "Clear cell⌫",
281
- "Delete rowCtrl+⌫",
282
- "Move row upCtrl+Alt+Shift+↑",
283
- "Move row downCtrl+Alt+Shift+↓",
284
- ]
285
- `);
286
- },
287
- );
288
- // second row menu item check
289
- ffTest(
290
- 'platform.editor.table.new-cell-context-menu-styling',
291
- () => {
292
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
293
-
294
- const tableRef = editorView.dom.querySelector('table');
295
- const editorRef = {
296
- current: document.createElement('div'),
297
- };
298
- render(
299
- <ReactEditorViewContext.Provider
300
- value={{
301
- editorRef,
302
- }}
303
- >
304
- <div id="drag-handle-button-row">dragmenu anchor</div>
305
- <IntlProvider locale="en">
306
- <DragMenu
307
- editorView={editorView}
308
- isOpen={true}
309
- getEditorContainerWidth={jest.fn()}
310
- tableRef={tableRef as HTMLTableElement}
311
- tableNode={tableNode?.node}
312
- direction="row"
313
- index={1}
314
- />
315
- </IntlProvider>
316
- </ReactEditorViewContext.Provider>,
317
- );
318
-
319
- const items = screen.getAllByRole('menuitem');
320
- const menuitemTextArray = items.map((item) => item.textContent);
321
- expect(menuitemTextArray).toMatchInlineSnapshot(`
322
- Array [
323
- "Add row aboveCtrl+Alt+↑",
324
- "Add row belowCtrl+Alt+↓",
325
- "Clear cell⌫",
326
- "Delete rowCtrl+⌫",
327
- "Move row upCtrl+Alt+Shift+↑",
328
- "Move row downCtrl+Alt+Shift+↓",
329
- "Row numbers",
330
- ]
331
- `);
332
- },
333
- () => {
334
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
335
- const tableRef = editorView.dom.querySelector('table');
336
- const editorRef = {
337
- current: document.createElement('div'),
338
- };
339
- render(
340
- <ReactEditorViewContext.Provider
341
- value={{
342
- editorRef,
343
- }}
344
- >
345
- <div id="drag-handle-button-row">dragmenu anchor</div>
346
- <IntlProvider locale="en">
347
- <DragMenu
348
- editorView={editorView}
349
- isOpen={true}
350
- getEditorContainerWidth={jest.fn()}
351
- tableRef={tableRef as HTMLTableElement}
352
- tableNode={tableNode?.node}
353
- direction="row"
354
- index={1}
355
- />
356
- </IntlProvider>
357
- </ReactEditorViewContext.Provider>,
358
- );
359
-
360
- const items = screen.getAllByRole('menuitem');
361
- const menuitemTextArray = items.map((item) => item.textContent);
362
- expect(menuitemTextArray).toMatchInlineSnapshot(`
363
- Array [
364
- "Add row aboveCtrl+Alt+↑",
365
- "Add row belowCtrl+Alt+↓",
366
- "Clear cell⌫",
367
- "Delete rowCtrl+⌫",
368
- "Move row upCtrl+Alt+Shift+↑",
369
- "Move row downCtrl+Alt+Shift+↓",
370
- ]
371
- `);
372
- },
373
- );
374
- // first column menu item check
375
- ffTest(
376
- 'platform.editor.table.new-cell-context-menu-styling',
377
- () => {
378
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
379
-
380
- const tableRef = editorView.dom.querySelector('table');
381
- const editorRef = {
382
- current: document.createElement('div'),
383
- };
384
- render(
385
- <ReactEditorViewContext.Provider
386
- value={{
387
- editorRef,
388
- }}
389
- >
390
- <div id="drag-handle-button-row">dragmenu anchor</div>
391
- <IntlProvider locale="en">
392
- <DragMenu
393
- editorView={editorView}
394
- isOpen={true}
395
- getEditorContainerWidth={jest.fn()}
396
- tableRef={tableRef as HTMLTableElement}
397
- tableNode={tableNode?.node}
398
- direction="column"
399
- index={0}
400
- />
401
- </IntlProvider>
402
- </ReactEditorViewContext.Provider>,
403
- );
404
-
405
- const items = screen.getAllByRole('menuitem');
406
- const menuitemTextArray = items.map((item) => item.textContent);
407
- expect(menuitemTextArray).toMatchInlineSnapshot(`
408
- Array [
409
- "Add column leftCtrl+Alt+←",
410
- "Add column rightCtrl+Alt+→",
411
- "Distribute columns",
412
- "Clear cell⌫",
413
- "Delete columnCtrl+⌫",
414
- "Move column leftCtrl+Alt+Shift+←",
415
- "Move column rightCtrl+Alt+Shift+→",
416
- "Sort increasing",
417
- "Sort decreasing",
418
- "Header column",
419
- ]
420
- `);
421
- },
422
- () => {
423
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
424
- const tableRef = editorView.dom.querySelector('table');
425
- const editorRef = {
426
- current: document.createElement('div'),
427
- };
428
- render(
429
- <ReactEditorViewContext.Provider
430
- value={{
431
- editorRef,
432
- }}
433
- >
434
- <div id="drag-handle-button-row">dragmenu anchor</div>
435
- <IntlProvider locale="en">
436
- <DragMenu
437
- editorView={editorView}
438
- isOpen={true}
439
- getEditorContainerWidth={jest.fn()}
440
- tableRef={tableRef as HTMLTableElement}
441
- tableNode={tableNode?.node}
442
- direction="column"
443
- index={0}
444
- />
445
- </IntlProvider>
446
- </ReactEditorViewContext.Provider>,
447
- );
448
-
449
- const items = screen.getAllByRole('menuitem');
450
- const menuitemTextArray = items.map((item) => item.textContent);
451
- expect(menuitemTextArray).toMatchInlineSnapshot(`
452
- Array [
453
- "Add column leftCtrl+Alt+←",
454
- "Add column rightCtrl+Alt+→",
455
- "Distribute columns",
456
- "Clear cell⌫",
457
- "Delete columnCtrl+⌫",
458
- "Move column leftCtrl+Alt+Shift+←",
459
- "Move column rightCtrl+Alt+Shift+→",
460
- "Sort increasing",
461
- "Sort decreasing",
462
- ]
463
- `);
464
- },
465
- );
466
- // second column menu item check
467
- ffTest('platform.editor.table.new-cell-context-menu-styling', () => {
468
- // Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
469
- const tableRef = editorView.dom.querySelector('table');
470
- const editorRef = {
471
- current: document.createElement('div'),
472
- };
473
- render(
474
- <ReactEditorViewContext.Provider
475
- value={{
476
- editorRef,
477
- }}
478
- >
479
- <div id="drag-handle-button-row">dragmenu anchor</div>
480
- <IntlProvider locale="en">
481
- <DragMenu
482
- editorView={editorView}
483
- isOpen={true}
484
- getEditorContainerWidth={jest.fn()}
485
- tableRef={tableRef as HTMLTableElement}
486
- tableNode={tableNode?.node}
487
- direction="column"
488
- index={1}
489
- />
490
- </IntlProvider>
491
- </ReactEditorViewContext.Provider>,
492
- );
493
-
494
- const items = screen.getAllByRole('menuitem');
495
- const menuitemTextArray = items.map((item) => item.textContent);
496
- expect(menuitemTextArray).toMatchInlineSnapshot(`
497
- Array [
498
- "Add column leftCtrl+Alt+←",
499
- "Add column rightCtrl+Alt+→",
500
- "Distribute columns",
501
- "Clear cell⌫",
502
- "Delete columnCtrl+⌫",
503
- "Move column leftCtrl+Alt+Shift+←",
504
- "Move column rightCtrl+Alt+Shift+→",
505
- "Sort increasing",
506
- "Sort decreasing",
507
- ]
508
- `);
509
- });
510
- });
511
- });