@atlaskit/editor-plugin-table 7.2.2 → 7.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
- package/dist/cjs/utils/drag-menu.js +37 -23
- package/dist/cjs/utils/merged-cells.js +66 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/es2019/utils/drag-menu.js +38 -14
- package/dist/es2019/utils/merged-cells.js +73 -0
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/esm/utils/drag-menu.js +36 -22
- package/dist/esm/utils/merged-cells.js +65 -0
- package/dist/types/utils/drag-menu.d.ts +4 -1
- package/dist/types/utils/merged-cells.d.ts +2 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
- package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
- package/package.json +9 -16
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
- package/src/utils/drag-menu.ts +94 -20
- package/src/utils/merged-cells.ts +78 -0
- package/tsconfig.dev.json +0 -69
- package/tsconfig.json +2 -877
- package/examples/99-testing.tsx +0 -140
- package/examples/config.jsonc +0 -14
- package/src/__tests__/unit/analytics.ts +0 -888
- package/src/__tests__/unit/collab.ts +0 -93
- package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
- package/src/__tests__/unit/commands/insert.ts +0 -137
- package/src/__tests__/unit/commands/misc.ts +0 -185
- package/src/__tests__/unit/commands/sort.ts +0 -128
- package/src/__tests__/unit/commands.ts +0 -745
- package/src/__tests__/unit/copy-button.ts +0 -22
- package/src/__tests__/unit/copy-paste.ts +0 -677
- package/src/__tests__/unit/event-handlers/index.ts +0 -125
- package/src/__tests__/unit/event-handlers.ts +0 -296
- package/src/__tests__/unit/fix-tables.ts +0 -164
- package/src/__tests__/unit/get-toolbar-config.ts +0 -127
- package/src/__tests__/unit/handlers.ts +0 -98
- package/src/__tests__/unit/hover-selection.ts +0 -230
- package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
- package/src/__tests__/unit/index.ts +0 -912
- package/src/__tests__/unit/layout.ts +0 -146
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
- package/src/__tests__/unit/nodeviews/cell.ts +0 -132
- package/src/__tests__/unit/nodeviews/table.ts +0 -129
- package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
- package/src/__tests__/unit/pm-plugins/main.ts +0 -214
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
- package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
- package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
- package/src/__tests__/unit/sort-column.ts +0 -399
- package/src/__tests__/unit/toolbar.ts +0 -512
- package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
- package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
- package/src/__tests__/unit/transforms/merging.ts +0 -392
- package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
- package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
- package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
- package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
- package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
- package/src/__tests__/unit/ui/RowControls.tsx +0 -294
- package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
- package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
- package/src/__tests__/unit/undo-redo.ts +0 -220
- package/src/__tests__/unit/utils/analytics.ts +0 -98
- package/src/__tests__/unit/utils/collapse.ts +0 -57
- package/src/__tests__/unit/utils/column-controls.ts +0 -205
- package/src/__tests__/unit/utils/dom.ts +0 -180
- package/src/__tests__/unit/utils/merged-cells.ts +0 -156
- package/src/__tests__/unit/utils/nodes.ts +0 -79
- package/src/__tests__/unit/utils/row-controls.ts +0 -195
- package/src/__tests__/unit/utils/table.ts +0 -96
- package/src/__tests__/unit/utils.ts +0 -670
- package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
- package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
- package/src/__tests__/visual-regression/copy-button.ts +0 -181
- package/src/__tests__/visual-regression/index.ts +0 -62
- 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
|
-
});
|