@atlaskit/editor-plugin-table 3.0.2 → 3.0.4
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 +15 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +12 -1
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/table/ui/ui-styles.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +14 -3
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/table/ui/ui-styles.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +14 -3
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/table/ui/ui-styles.js +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +6 -5
- package/dist/types/plugins/table/pm-plugins/sticky-headers/util.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-local-id.d.ts +1 -1
- package/dist/types/plugins/table/ui/consts.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +6 -5
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -1
- package/package.json +6 -6
- package/src/__tests__/integration/arrow-down-into-table.ts +2 -0
- package/src/__tests__/integration/auto-size.ts +3 -0
- package/src/__tests__/integration/cell-selection.ts +3 -0
- package/src/__tests__/integration/delete-columns.ts +2 -0
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +2 -0
- package/src/__tests__/integration/delete-last-column-with-empty-action.ts +2 -0
- package/src/__tests__/integration/delete-last-row-with-empty-action.ts +2 -0
- package/src/__tests__/integration/delete-rows.ts +3 -0
- package/src/__tests__/integration/delete-table-when-selected.ts +3 -0
- package/src/__tests__/integration/deleting-empty-paragraph-under-table.ts +2 -0
- package/src/__tests__/integration/even-columns.ts +3 -0
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +2 -0
- package/src/__tests__/integration/horizontal-scroll.ts +4 -1
- package/src/__tests__/integration/insert-cell-header-with-strong-mark.ts +2 -0
- package/src/__tests__/integration/insert-row-inside-layout.ts +3 -0
- package/src/__tests__/integration/layout.ts +3 -0
- package/src/__tests__/integration/meta-arrowup-cursor-in-first-row.ts +2 -0
- package/src/__tests__/integration/resize-handler.ts +3 -0
- package/src/__tests__/integration/resize.ts +4 -1
- package/src/__tests__/integration/scale.ts +3 -0
- package/src/__tests__/integration/sticky-header.ts +3 -1
- package/src/__tests__/unit/analytics.ts +4 -0
- package/src/__tests__/unit/collab.ts +3 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +3 -0
- package/src/__tests__/unit/commands/insert.ts +3 -0
- package/src/__tests__/unit/commands/misc.ts +3 -0
- package/src/__tests__/unit/commands/sort.ts +3 -0
- package/src/__tests__/unit/commands.ts +3 -0
- package/src/__tests__/unit/copy-paste.ts +5 -0
- package/src/__tests__/unit/event-handlers/index.ts +3 -0
- package/src/__tests__/unit/event-handlers.ts +3 -0
- package/src/__tests__/unit/fix-tables.ts +3 -0
- package/src/__tests__/unit/get-toolbar-config.ts +3 -0
- package/src/__tests__/unit/handlers.ts +3 -0
- package/src/__tests__/unit/hover-selection.ts +4 -0
- package/src/__tests__/unit/index-with-fake-timers.ts +2 -0
- package/src/__tests__/unit/index.ts +4 -0
- package/src/__tests__/unit/layout.ts +3 -0
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +1 -0
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +2 -0
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +2 -0
- package/src/__tests__/unit/nodeviews/cell.ts +3 -0
- package/src/__tests__/unit/nodeviews/table.ts +4 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +3 -0
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +3 -0
- package/src/__tests__/unit/pm-plugins/main.ts +3 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +3 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +5 -1
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +4 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +2 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +3 -0
- package/src/__tests__/unit/pm-plugins/table-width.ts +3 -0
- package/src/__tests__/unit/sort-column.ts +3 -0
- package/src/__tests__/unit/toolbar.ts +3 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +3 -0
- package/src/__tests__/unit/transforms/delete-rows.ts +3 -0
- package/src/__tests__/unit/transforms/merging.ts +3 -0
- package/src/__tests__/unit/ui/ContextualMenu.tsx +3 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +3 -0
- package/src/__tests__/unit/ui/RowControls.tsx +4 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +3 -0
- package/src/__tests__/unit/undo-redo.ts +4 -0
- package/src/__tests__/unit/utils/collapse.ts +3 -0
- package/src/__tests__/unit/utils/nodes.ts +3 -0
- package/src/__tests__/unit/utils/row-controls.ts +3 -0
- package/src/__tests__/unit/utils/table.ts +2 -0
- package/src/__tests__/unit/utils.ts +3 -0
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/src/__tests__/visual-regression/cell-options-menu.ts +3 -1
- package/src/__tests__/visual-regression/index.ts +4 -1
- package/src/__tests__/visual-regression/sticky-header.ts +4 -1
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +26 -7
- package/src/plugins/table/pm-plugins/sticky-headers/util.ts +1 -1
- package/src/plugins/table/pm-plugins/table-local-id.ts +5 -4
- package/src/plugins/table/ui/consts.ts +13 -2
- package/src/plugins/table/ui/ui-styles.ts +2 -2
- package/src/__tests__/integration/__snapshots__/floating-toolbar.ts.snap +0 -613
- package/src/__tests__/integration/floating-toolbar.ts +0 -374
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
animationFrame,
|
|
3
|
-
editable,
|
|
4
|
-
fullpage,
|
|
5
|
-
getDocFromElement,
|
|
6
|
-
} from '@atlaskit/editor-test-helpers/integration/helpers';
|
|
7
|
-
import {
|
|
8
|
-
clickFirstCell,
|
|
9
|
-
multiCellTableSelectionBottomRightToMiddleTopCell,
|
|
10
|
-
tableSelectors,
|
|
11
|
-
} from '@atlaskit/editor-test-helpers/page-objects/table';
|
|
12
|
-
import {
|
|
13
|
-
goToEditorTestingWDExample,
|
|
14
|
-
mountEditor,
|
|
15
|
-
} from '@atlaskit/editor-test-helpers/testing-example-page';
|
|
16
|
-
import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
|
|
17
|
-
|
|
18
|
-
import { TableCssClassName } from '../../plugins/table/types';
|
|
19
|
-
|
|
20
|
-
import basicTable from './__fixtures__/basic-table';
|
|
21
|
-
import basicTableWithMergedCell from './__fixtures__/basic-table-with-merged-cell';
|
|
22
|
-
import { documentWithMergedCells } from './__fixtures__/merged-rows-and-cols-document';
|
|
23
|
-
|
|
24
|
-
BrowserTestCase(
|
|
25
|
-
'should floating toolbar context menu sit above other context menu layers',
|
|
26
|
-
{ skip: [] },
|
|
27
|
-
async (client: any) => {
|
|
28
|
-
const page = await goToEditorTestingWDExample(
|
|
29
|
-
client,
|
|
30
|
-
'editor-plugin-table',
|
|
31
|
-
);
|
|
32
|
-
await mountEditor(page, {
|
|
33
|
-
appearance: fullpage.appearance,
|
|
34
|
-
allowTables: {
|
|
35
|
-
advanced: true,
|
|
36
|
-
allowColumnSorting: true,
|
|
37
|
-
allowDistributeColumns: true,
|
|
38
|
-
},
|
|
39
|
-
defaultValue: basicTable,
|
|
40
|
-
});
|
|
41
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
42
|
-
// Select the all cells under column 2 and 3
|
|
43
|
-
await multiCellTableSelectionBottomRightToMiddleTopCell(page);
|
|
44
|
-
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
45
|
-
const cellOptionsMenuItem = await (
|
|
46
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
47
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
48
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
49
|
-
await cellOptionsMenuItem.click();
|
|
50
|
-
// Get the z-index style value of the delete icon popup
|
|
51
|
-
const popupZIndex = await page.evaluate(() => {
|
|
52
|
-
const popupSelector = 'div[aria-label="Popup"][data-editor-popup=true]';
|
|
53
|
-
const deleteIconSelector = 'button.pm-table-controls__delete-button';
|
|
54
|
-
return +(
|
|
55
|
-
(
|
|
56
|
-
document
|
|
57
|
-
?.querySelector(`${popupSelector} ${deleteIconSelector}`)
|
|
58
|
-
?.closest(popupSelector) as HTMLElement | null
|
|
59
|
-
)?.style.zIndex || 0
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
// Get the z-index style value of the table floating toolbar context menu
|
|
63
|
-
const floatingTablePopupZIndex = await page.evaluate(() => {
|
|
64
|
-
const floatingTablePopupSelector =
|
|
65
|
-
'div[aria-label="Table floating controls"][data-editor-popup=true]';
|
|
66
|
-
return +(
|
|
67
|
-
(
|
|
68
|
-
document?.querySelector(
|
|
69
|
-
floatingTablePopupSelector,
|
|
70
|
-
) as HTMLElement | null
|
|
71
|
-
)?.style.zIndex || 0
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
// Floating toolbar context menu should sit above the popup
|
|
75
|
-
expect(floatingTablePopupZIndex).toBeGreaterThan(popupZIndex);
|
|
76
|
-
},
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
BrowserTestCase(
|
|
80
|
-
'should show hover indicators on delete columns menu option',
|
|
81
|
-
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
82
|
-
async (client: any, testName: string) => {
|
|
83
|
-
const page = await goToEditorTestingWDExample(
|
|
84
|
-
client,
|
|
85
|
-
'editor-plugin-table',
|
|
86
|
-
);
|
|
87
|
-
await mountEditor(page, {
|
|
88
|
-
appearance: fullpage.appearance,
|
|
89
|
-
allowTables: {
|
|
90
|
-
advanced: true,
|
|
91
|
-
allowColumnSorting: true,
|
|
92
|
-
allowDistributeColumns: true,
|
|
93
|
-
},
|
|
94
|
-
defaultValue: basicTable,
|
|
95
|
-
});
|
|
96
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
97
|
-
|
|
98
|
-
// First click on the cell
|
|
99
|
-
await clickFirstCell(page);
|
|
100
|
-
|
|
101
|
-
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
102
|
-
const cellOptionsMenuItem = await (
|
|
103
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
104
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
105
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
106
|
-
await cellOptionsMenuItem.click();
|
|
107
|
-
|
|
108
|
-
// Hover on the "Delete column" menu option on the context menu
|
|
109
|
-
const deleteColumnMenuItem = await (
|
|
110
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
111
|
-
).$(`button=${tableSelectors.removeColumnText}`);
|
|
112
|
-
await deleteColumnMenuItem.moveTo();
|
|
113
|
-
await animationFrame(page);
|
|
114
|
-
|
|
115
|
-
// Check the first column cells should have the hover indicators appear
|
|
116
|
-
const hoverCells = await page.$$(
|
|
117
|
-
`tbody tr th.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_COLUMN}, tbody tr td.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_COLUMN}`,
|
|
118
|
-
);
|
|
119
|
-
expect(hoverCells.length).toBe(3);
|
|
120
|
-
|
|
121
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
122
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
123
|
-
},
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
BrowserTestCase(
|
|
127
|
-
'should show hover indicators on delete rows menu option',
|
|
128
|
-
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
129
|
-
async (client: any, testName: string) => {
|
|
130
|
-
const page = await goToEditorTestingWDExample(
|
|
131
|
-
client,
|
|
132
|
-
'editor-plugin-table',
|
|
133
|
-
);
|
|
134
|
-
await mountEditor(page, {
|
|
135
|
-
appearance: fullpage.appearance,
|
|
136
|
-
allowTables: {
|
|
137
|
-
allowColumnSorting: true,
|
|
138
|
-
allowDistributeColumns: true,
|
|
139
|
-
},
|
|
140
|
-
defaultValue: basicTable,
|
|
141
|
-
});
|
|
142
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
143
|
-
|
|
144
|
-
// First click on the cell
|
|
145
|
-
await clickFirstCell(page);
|
|
146
|
-
|
|
147
|
-
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
148
|
-
const cellOptionsMenuItem = await (
|
|
149
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
150
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
151
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
152
|
-
await cellOptionsMenuItem.click();
|
|
153
|
-
|
|
154
|
-
// Hover on the "Delete row" menu option on the context menu
|
|
155
|
-
const deleteRowMenuItem = await (
|
|
156
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
157
|
-
).$(`button=${tableSelectors.removeRowText}`);
|
|
158
|
-
await deleteRowMenuItem.moveTo();
|
|
159
|
-
await animationFrame(page);
|
|
160
|
-
|
|
161
|
-
// Check the first row cells should have the hover indicators appear (second row from the top)
|
|
162
|
-
const hoverCells = await page.$$(
|
|
163
|
-
`tbody tr:nth-child(2) td.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_ROW}`,
|
|
164
|
-
);
|
|
165
|
-
expect(hoverCells.length).toBe(3);
|
|
166
|
-
|
|
167
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
168
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
169
|
-
},
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
BrowserTestCase(
|
|
173
|
-
'should show tooltip on hover on disabled sort button then remove it on mouse out',
|
|
174
|
-
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
175
|
-
async (client: any, testName: string) => {
|
|
176
|
-
const page = await goToEditorTestingWDExample(
|
|
177
|
-
client,
|
|
178
|
-
'editor-plugin-table',
|
|
179
|
-
);
|
|
180
|
-
await mountEditor(page, {
|
|
181
|
-
appearance: fullpage.appearance,
|
|
182
|
-
allowTables: {
|
|
183
|
-
allowColumnSorting: true,
|
|
184
|
-
allowDistributeColumns: true,
|
|
185
|
-
},
|
|
186
|
-
defaultValue: documentWithMergedCells,
|
|
187
|
-
});
|
|
188
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
189
|
-
const sortColumnButtonSelector =
|
|
190
|
-
'div[data-role=droplistContent] div[role=presentation]';
|
|
191
|
-
const tooltipSelector = 'div.atlaskit-portal div[role=tooltip]';
|
|
192
|
-
|
|
193
|
-
// Click on the cell on the table
|
|
194
|
-
await clickFirstCell(page);
|
|
195
|
-
|
|
196
|
-
// Table floating toolbar should appear, then hover on "Cell Options", which brings up another context menu
|
|
197
|
-
const cellOptionsMenuItem = await (
|
|
198
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
199
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
200
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
201
|
-
await cellOptionsMenuItem.click();
|
|
202
|
-
|
|
203
|
-
// No tooltip is shown
|
|
204
|
-
expect((await page.$$(tooltipSelector)).length).toBe(0);
|
|
205
|
-
|
|
206
|
-
// Expect there are 2 sort column tooltip menu option
|
|
207
|
-
const sortColumnButtons = await page.$$(sortColumnButtonSelector);
|
|
208
|
-
expect(sortColumnButtons.length).toBe(2);
|
|
209
|
-
const tooltip = await page.$(tooltipSelector);
|
|
210
|
-
|
|
211
|
-
// Hover Sort column A -> Z button then it should show tooltip, and should be removed after mouseout
|
|
212
|
-
const sortAtoZButton = sortColumnButtons[0];
|
|
213
|
-
await sortAtoZButton.moveTo();
|
|
214
|
-
await tooltip.waitForExist();
|
|
215
|
-
expect((await page.$$(tooltipSelector)).length).toBe(1);
|
|
216
|
-
await cellOptionsMenuItem.moveTo();
|
|
217
|
-
await tooltip.waitUntil(async () => {
|
|
218
|
-
return (await page.$$(tooltipSelector)).length === 0;
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// Hover Sort column Z -> A button then it should show tooltip, and should be removed after mouseout
|
|
222
|
-
const sortZtoAButton = sortColumnButtons[1];
|
|
223
|
-
await sortZtoAButton.moveTo();
|
|
224
|
-
await tooltip.waitForExist();
|
|
225
|
-
expect((await page.$$(tooltipSelector)).length).toBe(1);
|
|
226
|
-
await cellOptionsMenuItem.moveTo();
|
|
227
|
-
await tooltip.waitUntil(async () => {
|
|
228
|
-
return (await page.$$(tooltipSelector)).length === 0;
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
BrowserTestCase(
|
|
234
|
-
'should show yellow highlight on the megred rows when hover disabled sort column ASC menu option',
|
|
235
|
-
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
236
|
-
async (client: any, testName: string) => {
|
|
237
|
-
const page = await goToEditorTestingWDExample(
|
|
238
|
-
client,
|
|
239
|
-
'editor-plugin-table',
|
|
240
|
-
);
|
|
241
|
-
await mountEditor(page, {
|
|
242
|
-
appearance: fullpage.appearance,
|
|
243
|
-
allowTables: {
|
|
244
|
-
allowColumnSorting: true,
|
|
245
|
-
allowDistributeColumns: true,
|
|
246
|
-
},
|
|
247
|
-
defaultValue: basicTableWithMergedCell,
|
|
248
|
-
});
|
|
249
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
250
|
-
|
|
251
|
-
// Click on the cell on the table
|
|
252
|
-
await clickFirstCell(page);
|
|
253
|
-
|
|
254
|
-
// Table floating toolbar should appear, then hover on "Cell Options", which brings up another context menu
|
|
255
|
-
const cellOptionsMenuItem = await (
|
|
256
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
257
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
258
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
259
|
-
await cellOptionsMenuItem.click();
|
|
260
|
-
|
|
261
|
-
// Hover on the "Sort column ASC" menu option on the context menu
|
|
262
|
-
const sortColumnAscMenuItem = await (
|
|
263
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
264
|
-
).$(`button=${tableSelectors.sortColumnASC}`);
|
|
265
|
-
await sortColumnAscMenuItem.moveTo();
|
|
266
|
-
await animationFrame(page);
|
|
267
|
-
|
|
268
|
-
// Check there the yellow highlight background on the merged cells.
|
|
269
|
-
const highlightedCell = await page.$$(
|
|
270
|
-
`tbody tr:nth-child(3) td.${TableCssClassName.HOVERED_CELL_WARNING}`,
|
|
271
|
-
);
|
|
272
|
-
expect(highlightedCell.length).toBe(1);
|
|
273
|
-
await animationFrame(page);
|
|
274
|
-
|
|
275
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
276
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
277
|
-
},
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
BrowserTestCase(
|
|
281
|
-
'should show yellow highlight on the megred rows when hover disabled sort column DESC menu option',
|
|
282
|
-
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
283
|
-
async (client: any, testName: string) => {
|
|
284
|
-
const page = await goToEditorTestingWDExample(
|
|
285
|
-
client,
|
|
286
|
-
'editor-plugin-table',
|
|
287
|
-
);
|
|
288
|
-
await mountEditor(page, {
|
|
289
|
-
appearance: fullpage.appearance,
|
|
290
|
-
allowTables: {
|
|
291
|
-
allowColumnSorting: true,
|
|
292
|
-
allowDistributeColumns: true,
|
|
293
|
-
},
|
|
294
|
-
defaultValue: basicTableWithMergedCell,
|
|
295
|
-
});
|
|
296
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
297
|
-
|
|
298
|
-
// Click on the cell on the table
|
|
299
|
-
await clickFirstCell(page);
|
|
300
|
-
|
|
301
|
-
// Table floating toolbar should appear, then hover on "Cell Options", which brings up another context menu
|
|
302
|
-
const cellOptionsMenuItem = await (
|
|
303
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
304
|
-
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
305
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
306
|
-
await cellOptionsMenuItem.click();
|
|
307
|
-
|
|
308
|
-
// Hover on the "Sort column DESC" menu option on the context menu
|
|
309
|
-
const sortColumnDescMenuItem = await (
|
|
310
|
-
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
311
|
-
).$(`button=${tableSelectors.sortColumnDESC}`);
|
|
312
|
-
await sortColumnDescMenuItem.moveTo();
|
|
313
|
-
await animationFrame(page);
|
|
314
|
-
|
|
315
|
-
// Check there the yellow highlight background on the merged cells.
|
|
316
|
-
const highlightedCell = await page.$$(
|
|
317
|
-
`tbody tr:nth-child(3) td.${TableCssClassName.HOVERED_CELL_WARNING}`,
|
|
318
|
-
);
|
|
319
|
-
expect(highlightedCell.length).toBe(1);
|
|
320
|
-
await animationFrame(page);
|
|
321
|
-
|
|
322
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
323
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
324
|
-
},
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
BrowserTestCase(
|
|
328
|
-
'should the context menu disabled item stay open when clicked.',
|
|
329
|
-
{ skip: [] },
|
|
330
|
-
async (client: any, testName: string) => {
|
|
331
|
-
const page = await goToEditorTestingWDExample(
|
|
332
|
-
client,
|
|
333
|
-
'editor-plugin-table',
|
|
334
|
-
);
|
|
335
|
-
await mountEditor(page, {
|
|
336
|
-
appearance: fullpage.appearance,
|
|
337
|
-
allowTables: {
|
|
338
|
-
allowColumnSorting: true,
|
|
339
|
-
allowDistributeColumns: true,
|
|
340
|
-
},
|
|
341
|
-
defaultValue: basicTable,
|
|
342
|
-
});
|
|
343
|
-
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
344
|
-
|
|
345
|
-
// First click on the cell
|
|
346
|
-
await clickFirstCell(page);
|
|
347
|
-
|
|
348
|
-
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
349
|
-
const tableFloatingToolbar = await page.$(
|
|
350
|
-
tableFloatingToolbarContextMenuSelector,
|
|
351
|
-
);
|
|
352
|
-
tableFloatingToolbar.waitForExist();
|
|
353
|
-
await animationFrame(page);
|
|
354
|
-
|
|
355
|
-
const cellOptionsMenuItem = await tableFloatingToolbar.$(
|
|
356
|
-
`button=${tableSelectors.cellOptionsFloatingToolbarText}`,
|
|
357
|
-
);
|
|
358
|
-
await cellOptionsMenuItem.waitForClickable();
|
|
359
|
-
await cellOptionsMenuItem.click();
|
|
360
|
-
await animationFrame(page);
|
|
361
|
-
|
|
362
|
-
// Hover on the "Merge Cell" menu option on the context menu (which should be disabled)
|
|
363
|
-
const mergeCellsMenuItem = await tableFloatingToolbar.$(
|
|
364
|
-
`button=${tableSelectors.mergeCellsText}`,
|
|
365
|
-
);
|
|
366
|
-
expect(await mergeCellsMenuItem.getAttribute('disabled')).toBe('true');
|
|
367
|
-
await mergeCellsMenuItem.moveTo();
|
|
368
|
-
await mergeCellsMenuItem.click();
|
|
369
|
-
await animationFrame(page);
|
|
370
|
-
|
|
371
|
-
// The context menu should remains open, thus the menu item should still be visible
|
|
372
|
-
expect(await mergeCellsMenuItem.isDisplayed()).toBe(true);
|
|
373
|
-
},
|
|
374
|
-
);
|