@atlaskit/editor-plugin-table 0.2.2 → 0.2.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 +26 -0
- package/dist/cjs/plugins/table/commands/hover.js +2 -1
- package/dist/cjs/plugins/table/event-handlers.js +9 -13
- package/dist/cjs/plugins/table/index.js +3 -1
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +15 -5
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +42 -8
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
- package/dist/cjs/plugins/table/toolbar.js +42 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +7 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +34 -6
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +4 -4
- package/dist/cjs/plugins/table/ui/ui-styles.js +5 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/hover.js +2 -1
- package/dist/es2019/plugins/table/event-handlers.js +10 -13
- package/dist/es2019/plugins/table/index.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +12 -1
- package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +31 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +43 -12
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +6 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +47 -8
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +9 -9
- package/dist/es2019/plugins/table/ui/consts.js +5 -5
- package/dist/es2019/plugins/table/ui/ui-styles.js +5 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/hover.js +2 -1
- package/dist/esm/plugins/table/event-handlers.js +10 -14
- package/dist/esm/plugins/table/index.js +3 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +17 -6
- package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +43 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +43 -12
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +8 -2
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +28 -5
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -5
- package/dist/esm/plugins/table/ui/ui-styles.js +5 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/event-handlers.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +8 -0
- package/dist/types/plugins/table/toolbar.d.ts +3 -2
- package/dist/types/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -1
- package/dist/types/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -2
- package/dist/types/plugins/table/ui/common-styles.d.ts +3 -3
- package/dist/types/plugins/table/ui/consts.d.ts +2 -2
- package/dist/types/plugins/table/ui/ui-styles.d.ts +14 -14
- package/package.json +4 -4
- package/src/__tests__/integration/__snapshots__/floating-toolbar.ts.snap +321 -0
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +6 -5
- package/src/__tests__/integration/floating-toolbar.ts +169 -0
- package/src/__tests__/unit/get-toolbar-config.ts +1 -0
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +146 -4
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +82 -31
- package/src/__tests__/unit/toolbar.ts +165 -4
- 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/plugins/table/commands/hover.ts +1 -0
- package/src/plugins/table/event-handlers.ts +6 -17
- package/src/plugins/table/index.tsx +1 -0
- package/src/plugins/table/nodeviews/TableComponent.tsx +10 -2
- package/src/plugins/table/nodeviews/tableCell.tsx +1 -1
- package/src/plugins/table/pm-plugins/default-table-selection.ts +0 -1
- package/src/plugins/table/pm-plugins/main.ts +26 -28
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +44 -9
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +1 -1
- package/src/plugins/table/toolbar.tsx +60 -13
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +12 -2
- package/src/plugins/table/ui/FloatingContextualButton/styles.ts +51 -7
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +3 -0
- package/src/plugins/table/ui/common-styles.ts +24 -9
- package/src/plugins/table/ui/consts.ts +7 -5
- package/src/plugins/table/ui/ui-styles.ts +20 -5
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`should show hover indicators on delete columns menu option 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"content": Array [
|
|
6
|
+
Object {
|
|
7
|
+
"attrs": Object {
|
|
8
|
+
"__autoSize": false,
|
|
9
|
+
"isNumberColumnEnabled": false,
|
|
10
|
+
"layout": "default",
|
|
11
|
+
"localId": "abc-123",
|
|
12
|
+
},
|
|
13
|
+
"content": Array [
|
|
14
|
+
Object {
|
|
15
|
+
"content": Array [
|
|
16
|
+
Object {
|
|
17
|
+
"attrs": Object {
|
|
18
|
+
"background": null,
|
|
19
|
+
"colspan": 1,
|
|
20
|
+
"colwidth": null,
|
|
21
|
+
"rowspan": 1,
|
|
22
|
+
},
|
|
23
|
+
"content": Array [
|
|
24
|
+
Object {
|
|
25
|
+
"type": "paragraph",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
"type": "tableHeader",
|
|
29
|
+
},
|
|
30
|
+
Object {
|
|
31
|
+
"attrs": Object {
|
|
32
|
+
"background": null,
|
|
33
|
+
"colspan": 1,
|
|
34
|
+
"colwidth": null,
|
|
35
|
+
"rowspan": 1,
|
|
36
|
+
},
|
|
37
|
+
"content": Array [
|
|
38
|
+
Object {
|
|
39
|
+
"type": "paragraph",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"type": "tableHeader",
|
|
43
|
+
},
|
|
44
|
+
Object {
|
|
45
|
+
"attrs": Object {
|
|
46
|
+
"background": null,
|
|
47
|
+
"colspan": 1,
|
|
48
|
+
"colwidth": null,
|
|
49
|
+
"rowspan": 1,
|
|
50
|
+
},
|
|
51
|
+
"content": Array [
|
|
52
|
+
Object {
|
|
53
|
+
"type": "paragraph",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
"type": "tableHeader",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
"type": "tableRow",
|
|
60
|
+
},
|
|
61
|
+
Object {
|
|
62
|
+
"content": Array [
|
|
63
|
+
Object {
|
|
64
|
+
"attrs": Object {
|
|
65
|
+
"background": null,
|
|
66
|
+
"colspan": 1,
|
|
67
|
+
"colwidth": null,
|
|
68
|
+
"rowspan": 1,
|
|
69
|
+
},
|
|
70
|
+
"content": Array [
|
|
71
|
+
Object {
|
|
72
|
+
"type": "paragraph",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
"type": "tableCell",
|
|
76
|
+
},
|
|
77
|
+
Object {
|
|
78
|
+
"attrs": Object {
|
|
79
|
+
"background": null,
|
|
80
|
+
"colspan": 1,
|
|
81
|
+
"colwidth": null,
|
|
82
|
+
"rowspan": 1,
|
|
83
|
+
},
|
|
84
|
+
"content": Array [
|
|
85
|
+
Object {
|
|
86
|
+
"type": "paragraph",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
"type": "tableCell",
|
|
90
|
+
},
|
|
91
|
+
Object {
|
|
92
|
+
"attrs": Object {
|
|
93
|
+
"background": null,
|
|
94
|
+
"colspan": 1,
|
|
95
|
+
"colwidth": null,
|
|
96
|
+
"rowspan": 1,
|
|
97
|
+
},
|
|
98
|
+
"content": Array [
|
|
99
|
+
Object {
|
|
100
|
+
"type": "paragraph",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
"type": "tableCell",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
"type": "tableRow",
|
|
107
|
+
},
|
|
108
|
+
Object {
|
|
109
|
+
"content": Array [
|
|
110
|
+
Object {
|
|
111
|
+
"attrs": Object {
|
|
112
|
+
"background": null,
|
|
113
|
+
"colspan": 1,
|
|
114
|
+
"colwidth": null,
|
|
115
|
+
"rowspan": 1,
|
|
116
|
+
},
|
|
117
|
+
"content": Array [
|
|
118
|
+
Object {
|
|
119
|
+
"type": "paragraph",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
"type": "tableCell",
|
|
123
|
+
},
|
|
124
|
+
Object {
|
|
125
|
+
"attrs": Object {
|
|
126
|
+
"background": null,
|
|
127
|
+
"colspan": 1,
|
|
128
|
+
"colwidth": null,
|
|
129
|
+
"rowspan": 1,
|
|
130
|
+
},
|
|
131
|
+
"content": Array [
|
|
132
|
+
Object {
|
|
133
|
+
"type": "paragraph",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
"type": "tableCell",
|
|
137
|
+
},
|
|
138
|
+
Object {
|
|
139
|
+
"attrs": Object {
|
|
140
|
+
"background": null,
|
|
141
|
+
"colspan": 1,
|
|
142
|
+
"colwidth": null,
|
|
143
|
+
"rowspan": 1,
|
|
144
|
+
},
|
|
145
|
+
"content": Array [
|
|
146
|
+
Object {
|
|
147
|
+
"type": "paragraph",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
"type": "tableCell",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
"type": "tableRow",
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
"type": "table",
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
"type": "doc",
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
|
|
163
|
+
exports[`should show hover indicators on delete rows menu option 1`] = `
|
|
164
|
+
Object {
|
|
165
|
+
"content": Array [
|
|
166
|
+
Object {
|
|
167
|
+
"attrs": Object {
|
|
168
|
+
"__autoSize": false,
|
|
169
|
+
"isNumberColumnEnabled": false,
|
|
170
|
+
"layout": "default",
|
|
171
|
+
"localId": "abc-123",
|
|
172
|
+
},
|
|
173
|
+
"content": Array [
|
|
174
|
+
Object {
|
|
175
|
+
"content": Array [
|
|
176
|
+
Object {
|
|
177
|
+
"attrs": Object {
|
|
178
|
+
"background": null,
|
|
179
|
+
"colspan": 1,
|
|
180
|
+
"colwidth": null,
|
|
181
|
+
"rowspan": 1,
|
|
182
|
+
},
|
|
183
|
+
"content": Array [
|
|
184
|
+
Object {
|
|
185
|
+
"type": "paragraph",
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
"type": "tableHeader",
|
|
189
|
+
},
|
|
190
|
+
Object {
|
|
191
|
+
"attrs": Object {
|
|
192
|
+
"background": null,
|
|
193
|
+
"colspan": 1,
|
|
194
|
+
"colwidth": null,
|
|
195
|
+
"rowspan": 1,
|
|
196
|
+
},
|
|
197
|
+
"content": Array [
|
|
198
|
+
Object {
|
|
199
|
+
"type": "paragraph",
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
"type": "tableHeader",
|
|
203
|
+
},
|
|
204
|
+
Object {
|
|
205
|
+
"attrs": Object {
|
|
206
|
+
"background": null,
|
|
207
|
+
"colspan": 1,
|
|
208
|
+
"colwidth": null,
|
|
209
|
+
"rowspan": 1,
|
|
210
|
+
},
|
|
211
|
+
"content": Array [
|
|
212
|
+
Object {
|
|
213
|
+
"type": "paragraph",
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
"type": "tableHeader",
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
"type": "tableRow",
|
|
220
|
+
},
|
|
221
|
+
Object {
|
|
222
|
+
"content": Array [
|
|
223
|
+
Object {
|
|
224
|
+
"attrs": Object {
|
|
225
|
+
"background": null,
|
|
226
|
+
"colspan": 1,
|
|
227
|
+
"colwidth": null,
|
|
228
|
+
"rowspan": 1,
|
|
229
|
+
},
|
|
230
|
+
"content": Array [
|
|
231
|
+
Object {
|
|
232
|
+
"type": "paragraph",
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
"type": "tableCell",
|
|
236
|
+
},
|
|
237
|
+
Object {
|
|
238
|
+
"attrs": Object {
|
|
239
|
+
"background": null,
|
|
240
|
+
"colspan": 1,
|
|
241
|
+
"colwidth": null,
|
|
242
|
+
"rowspan": 1,
|
|
243
|
+
},
|
|
244
|
+
"content": Array [
|
|
245
|
+
Object {
|
|
246
|
+
"type": "paragraph",
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
"type": "tableCell",
|
|
250
|
+
},
|
|
251
|
+
Object {
|
|
252
|
+
"attrs": Object {
|
|
253
|
+
"background": null,
|
|
254
|
+
"colspan": 1,
|
|
255
|
+
"colwidth": null,
|
|
256
|
+
"rowspan": 1,
|
|
257
|
+
},
|
|
258
|
+
"content": Array [
|
|
259
|
+
Object {
|
|
260
|
+
"type": "paragraph",
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
"type": "tableCell",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
"type": "tableRow",
|
|
267
|
+
},
|
|
268
|
+
Object {
|
|
269
|
+
"content": Array [
|
|
270
|
+
Object {
|
|
271
|
+
"attrs": Object {
|
|
272
|
+
"background": null,
|
|
273
|
+
"colspan": 1,
|
|
274
|
+
"colwidth": null,
|
|
275
|
+
"rowspan": 1,
|
|
276
|
+
},
|
|
277
|
+
"content": Array [
|
|
278
|
+
Object {
|
|
279
|
+
"type": "paragraph",
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
"type": "tableCell",
|
|
283
|
+
},
|
|
284
|
+
Object {
|
|
285
|
+
"attrs": Object {
|
|
286
|
+
"background": null,
|
|
287
|
+
"colspan": 1,
|
|
288
|
+
"colwidth": null,
|
|
289
|
+
"rowspan": 1,
|
|
290
|
+
},
|
|
291
|
+
"content": Array [
|
|
292
|
+
Object {
|
|
293
|
+
"type": "paragraph",
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
"type": "tableCell",
|
|
297
|
+
},
|
|
298
|
+
Object {
|
|
299
|
+
"attrs": Object {
|
|
300
|
+
"background": null,
|
|
301
|
+
"colspan": 1,
|
|
302
|
+
"colwidth": null,
|
|
303
|
+
"rowspan": 1,
|
|
304
|
+
},
|
|
305
|
+
"content": Array [
|
|
306
|
+
Object {
|
|
307
|
+
"type": "paragraph",
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
"type": "tableCell",
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
"type": "tableRow",
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
"type": "table",
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
"type": "doc",
|
|
320
|
+
}
|
|
321
|
+
`;
|
|
@@ -56,11 +56,12 @@ BrowserTestCase(
|
|
|
56
56
|
await page.waitForVisible(deleteButtonSelector);
|
|
57
57
|
await page.click(deleteButtonSelector);
|
|
58
58
|
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
59
|
+
// TODO: Figure out why this is causing a warning and causing the following check to fail in chrome.
|
|
60
|
+
// await page.checkConsoleErrors({
|
|
61
|
+
// ignoreErrors: [
|
|
62
|
+
// /is potentially unsafe when doing server-side rendering\. Try changing it to/,
|
|
63
|
+
// ],
|
|
64
|
+
// });
|
|
64
65
|
|
|
65
66
|
const doc = await page.$eval(editable, getDocFromElement);
|
|
66
67
|
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
import { TableCssClassName } from '../../plugins/table/types';
|
|
18
|
+
import basicTable from './__fixtures__/basic-table';
|
|
19
|
+
|
|
20
|
+
BrowserTestCase(
|
|
21
|
+
'should floating toolbar context menu sit above other context menu layers',
|
|
22
|
+
{ skip: [] },
|
|
23
|
+
async (client: any) => {
|
|
24
|
+
const page = await goToEditorTestingWDExample(
|
|
25
|
+
client,
|
|
26
|
+
'editor-plugin-table',
|
|
27
|
+
);
|
|
28
|
+
await mountEditor(page, {
|
|
29
|
+
appearance: fullpage.appearance,
|
|
30
|
+
allowTables: {
|
|
31
|
+
advanced: true,
|
|
32
|
+
allowColumnSorting: true,
|
|
33
|
+
allowDistributeColumns: true,
|
|
34
|
+
allowCellOptionsInFloatingToolbar: true,
|
|
35
|
+
},
|
|
36
|
+
defaultValue: basicTable,
|
|
37
|
+
});
|
|
38
|
+
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
39
|
+
// Select the all cells under column 2 and 3
|
|
40
|
+
await multiCellTableSelectionBottomRightToMiddleTopCell(page);
|
|
41
|
+
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
42
|
+
const cellOptionsMenuItem = await (
|
|
43
|
+
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
44
|
+
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
45
|
+
await cellOptionsMenuItem.waitForClickable();
|
|
46
|
+
await cellOptionsMenuItem.click();
|
|
47
|
+
// Get the z-index style value of the delete icon popup
|
|
48
|
+
const popupZIndex = await page.evaluate(() => {
|
|
49
|
+
const popupSelector = 'div[aria-label="Popup"][data-editor-popup=true]';
|
|
50
|
+
const deleteIconSelector = 'button.pm-table-controls__delete-button';
|
|
51
|
+
return +(
|
|
52
|
+
(
|
|
53
|
+
document
|
|
54
|
+
?.querySelector(`${popupSelector} ${deleteIconSelector}`)
|
|
55
|
+
?.closest(popupSelector) as HTMLElement | null
|
|
56
|
+
)?.style.zIndex || 0
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
// Get the z-index style value of the table floating toolbar context menu
|
|
60
|
+
const floatingTablePopupZIndex = await page.evaluate(() => {
|
|
61
|
+
const floatingTablePopupSelector =
|
|
62
|
+
'div[aria-label="Table floating controls"][data-editor-popup=true]';
|
|
63
|
+
return +(
|
|
64
|
+
(
|
|
65
|
+
document?.querySelector(
|
|
66
|
+
floatingTablePopupSelector,
|
|
67
|
+
) as HTMLElement | null
|
|
68
|
+
)?.style.zIndex || 0
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
// Floating toolbar context menu should sit above the popup
|
|
72
|
+
expect(floatingTablePopupZIndex).toBeGreaterThan(popupZIndex);
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
BrowserTestCase(
|
|
77
|
+
'should show hover indicators on delete columns menu option',
|
|
78
|
+
{ skip: ['safari'] }, // The test does not pass on CI but works on physical browser
|
|
79
|
+
async (client: any, testName: string) => {
|
|
80
|
+
const page = await goToEditorTestingWDExample(
|
|
81
|
+
client,
|
|
82
|
+
'editor-plugin-table',
|
|
83
|
+
);
|
|
84
|
+
await mountEditor(page, {
|
|
85
|
+
appearance: fullpage.appearance,
|
|
86
|
+
allowTables: {
|
|
87
|
+
advanced: true,
|
|
88
|
+
allowColumnSorting: true,
|
|
89
|
+
allowDistributeColumns: true,
|
|
90
|
+
allowCellOptionsInFloatingToolbar: true,
|
|
91
|
+
},
|
|
92
|
+
defaultValue: basicTable,
|
|
93
|
+
});
|
|
94
|
+
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
95
|
+
|
|
96
|
+
// First click on the cell
|
|
97
|
+
await clickFirstCell(page);
|
|
98
|
+
|
|
99
|
+
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
100
|
+
const cellOptionsMenuItem = await (
|
|
101
|
+
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
102
|
+
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
103
|
+
await cellOptionsMenuItem.waitForClickable();
|
|
104
|
+
await cellOptionsMenuItem.click();
|
|
105
|
+
|
|
106
|
+
// Hover on the "Delete column" menu option on the context menu
|
|
107
|
+
const deleteColumnMenuItem = await (
|
|
108
|
+
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
109
|
+
).$(`button=${tableSelectors.removeColumnText}`);
|
|
110
|
+
await deleteColumnMenuItem.moveTo();
|
|
111
|
+
await animationFrame(page);
|
|
112
|
+
|
|
113
|
+
// Check the first column cells should have the hover indicators appear
|
|
114
|
+
const hoverCells = await page.$$(
|
|
115
|
+
`tbody tr th.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_COLUMN}, tbody tr td.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_COLUMN}`,
|
|
116
|
+
);
|
|
117
|
+
expect(hoverCells.length).toBe(3);
|
|
118
|
+
|
|
119
|
+
const doc = await page.$eval(editable, getDocFromElement);
|
|
120
|
+
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
BrowserTestCase(
|
|
125
|
+
'should show hover indicators on delete rows menu option',
|
|
126
|
+
{ skip: ['safari'] }, // The test does not pass on CI but works on physical browser
|
|
127
|
+
async (client: any, testName: string) => {
|
|
128
|
+
const page = await goToEditorTestingWDExample(
|
|
129
|
+
client,
|
|
130
|
+
'editor-plugin-table',
|
|
131
|
+
);
|
|
132
|
+
await mountEditor(page, {
|
|
133
|
+
appearance: fullpage.appearance,
|
|
134
|
+
allowTables: {
|
|
135
|
+
allowColumnSorting: true,
|
|
136
|
+
allowDistributeColumns: true,
|
|
137
|
+
allowCellOptionsInFloatingToolbar: true,
|
|
138
|
+
},
|
|
139
|
+
defaultValue: basicTable,
|
|
140
|
+
});
|
|
141
|
+
const tableFloatingToolbarContextMenuSelector = `div[aria-label="Table floating controls"][data-editor-popup=true]`;
|
|
142
|
+
|
|
143
|
+
// First click on the cell
|
|
144
|
+
await clickFirstCell(page);
|
|
145
|
+
|
|
146
|
+
// Table floating toolbar should appear, then click on "Cell Options", which brings up another context menu
|
|
147
|
+
const cellOptionsMenuItem = await (
|
|
148
|
+
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
149
|
+
).$(`button=${tableSelectors.cellOptionsFloatingToolbarText}`);
|
|
150
|
+
await cellOptionsMenuItem.waitForClickable();
|
|
151
|
+
await cellOptionsMenuItem.click();
|
|
152
|
+
|
|
153
|
+
// Hover on the "Delete row" menu option on the context menu
|
|
154
|
+
const deleteRowMenuItem = await (
|
|
155
|
+
await page.$(tableFloatingToolbarContextMenuSelector)
|
|
156
|
+
).$(`button=${tableSelectors.removeRowText}`);
|
|
157
|
+
await deleteRowMenuItem.moveTo();
|
|
158
|
+
await animationFrame(page);
|
|
159
|
+
|
|
160
|
+
// Check the first row cells should have the hover indicators appear (second row from the top)
|
|
161
|
+
const hoverCells = await page.$$(
|
|
162
|
+
`tbody tr:nth-child(2) td.${TableCssClassName.HOVERED_CELL}.${TableCssClassName.HOVERED_ROW}`,
|
|
163
|
+
);
|
|
164
|
+
expect(hoverCells.length).toBe(3);
|
|
165
|
+
|
|
166
|
+
const doc = await page.$eval(editable, getDocFromElement);
|
|
167
|
+
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
168
|
+
},
|
|
169
|
+
);
|