quill-table-up 3.1.2 → 3.2.1
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/README.md +15 -8
- package/dist/index.css +1 -1
- package/dist/index.d.ts +168 -146
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +52 -52
- package/dist/index.umd.js.map +1 -1
- package/package.json +22 -24
- package/src/__tests__/e2e/custom-creator.test.ts +44 -44
- package/src/__tests__/e2e/editor-page.ts +77 -77
- package/src/__tests__/e2e/table-align.test.ts +104 -104
- package/src/__tests__/e2e/table-blots.test.ts +169 -169
- package/src/__tests__/e2e/table-caption.test.ts +134 -134
- package/src/__tests__/e2e/table-clipboard.test.ts +20 -20
- package/src/__tests__/e2e/table-hack.test.ts +151 -151
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +20 -4
- package/src/__tests__/e2e/table-menu.test.ts +172 -172
- package/src/__tests__/e2e/table-resize.test.ts +654 -9
- package/src/__tests__/e2e/table-scrollbar.test.ts +144 -144
- package/src/__tests__/e2e/table-selection.test.ts +563 -563
- package/src/__tests__/e2e/types.d.ts +8 -7
- package/src/__tests__/e2e/utils.ts +52 -52
- package/src/__tests__/unit/table-blots.test.ts +720 -720
- package/src/__tests__/unit/table-caption.test.ts +234 -234
- package/src/__tests__/unit/table-cell-merge.test.ts +713 -724
- package/src/__tests__/unit/table-clipboard.test.ts +2176 -2176
- package/src/__tests__/unit/table-hack.test.ts +1014 -1014
- package/src/__tests__/unit/table-insert.test.ts +915 -926
- package/src/__tests__/unit/table-redo-undo.test.ts +2429 -2429
- package/src/__tests__/unit/table-remove.test.ts +313 -343
- package/src/__tests__/unit/utils.test-d.ts +49 -49
- package/src/__tests__/unit/utils.test.ts +711 -711
- package/src/__tests__/unit/utils.ts +307 -307
- package/src/__tests__/unit/vitest.d.ts +14 -14
- package/src/formats/container-format.ts +107 -107
- package/src/formats/overrides/block-embed.ts +72 -72
- package/src/formats/overrides/block.ts +95 -95
- package/src/formats/overrides/index.ts +3 -3
- package/src/formats/overrides/scroll.ts +70 -70
- package/src/formats/table-body-format.ts +52 -52
- package/src/formats/table-caption-format.ts +116 -116
- package/src/formats/table-cell-format.ts +304 -304
- package/src/formats/table-cell-inner-format.ts +403 -398
- package/src/formats/table-colgroup-format.ts +136 -136
- package/src/formats/table-foot-format.ts +7 -7
- package/src/formats/table-head-format.ts +7 -7
- package/src/formats/table-main-format.ts +1 -1
- package/src/formats/table-row-format.ts +218 -210
- package/src/formats/utils.ts +6 -6
- package/src/index.ts +19 -19
- package/src/modules/index.ts +7 -7
- package/src/modules/table-align.ts +131 -131
- package/src/modules/table-clipboard/table-clipboard.ts +6 -8
- package/src/modules/table-dom-selector.ts +33 -33
- package/src/modules/table-menu/constants.ts +223 -223
- package/src/modules/table-menu/index.ts +4 -4
- package/src/modules/table-menu/table-menu-common.ts +330 -329
- package/src/modules/table-menu/table-menu-contextmenu.ts +111 -118
- package/src/modules/table-menu/table-menu-select.ts +96 -94
- package/src/modules/table-resize/index.ts +5 -5
- package/src/modules/table-resize/table-resize-box.ts +714 -363
- package/src/modules/table-resize/table-resize-common.ts +246 -382
- package/src/modules/table-resize/table-resize-drag.ts +241 -0
- package/src/modules/table-resize/table-resize-line.ts +244 -182
- package/src/modules/table-resize/table-resize-scale.ts +174 -173
- package/src/modules/table-resize/utils.ts +84 -3
- package/src/modules/table-scrollbar.ts +292 -292
- package/src/modules/table-selection.ts +613 -669
- package/src/style/button.less +45 -45
- package/src/style/color-picker.less +136 -136
- package/src/style/dialog.less +53 -53
- package/src/style/functions.less +9 -9
- package/src/style/index.less +120 -120
- package/src/style/input.less +64 -64
- package/src/style/select-box.less +52 -52
- package/src/style/table-creator.less +56 -56
- package/src/style/table-menu.less +125 -125
- package/src/style/table-resize-scale.less +31 -31
- package/src/style/table-resize.less +249 -202
- package/src/style/table-scrollbar.less +49 -49
- package/src/style/table-selection.less +23 -23
- package/src/style/tooltip.less +19 -19
- package/src/style/variables.less +1 -1
- package/src/svg/arrow-up-down.svg +11 -11
- package/src/svg/convert-cell.svg +7 -7
- package/src/table-up.ts +1363 -1360
- package/src/types.d.ts +4 -4
- package/src/utils/bem.ts +23 -23
- package/src/utils/blot-helper.ts +101 -105
- package/src/utils/color.ts +109 -109
- package/src/utils/components/button.ts +22 -22
- package/src/utils/components/color-picker.ts +236 -236
- package/src/utils/components/dialog.ts +83 -41
- package/src/utils/components/index.ts +6 -6
- package/src/utils/components/input.ts +74 -74
- package/src/utils/components/table/creator.ts +89 -89
- package/src/utils/components/table/index.ts +2 -2
- package/src/utils/components/table/select-box.ts +78 -78
- package/src/utils/components/tooltip.ts +179 -189
- package/src/utils/constants.ts +125 -124
- package/src/utils/drag-helper.ts +112 -0
- package/src/utils/index.ts +15 -14
- package/src/utils/is.ts +9 -9
- package/src/utils/position.ts +60 -60
- package/src/utils/resize-observer-helper.ts +47 -47
- package/src/utils/scroll.ts +145 -47
- package/src/utils/style-helper.ts +47 -47
- package/src/utils/transformer.ts +10 -10
- package/src/utils/transition-event-helper.ts +8 -8
- package/src/utils/types.ts +156 -157
- package/src/utils/utils.ts +12 -12
|
@@ -1,563 +1,563 @@
|
|
|
1
|
-
import { expect, test } from '@playwright/test';
|
|
2
|
-
import { createTableBySelect, extendTest } from './utils';
|
|
3
|
-
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await page.goto('http://127.0.0.1:5500/docs/test.html');
|
|
6
|
-
page.locator('.ql-container.ql-snow');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
test('test TableSelection horizontal', async ({ page }) => {
|
|
10
|
-
await createTableBySelect(page, 'container1', 5, 5);
|
|
11
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
12
|
-
await cell.click();
|
|
13
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
14
|
-
expect(cellBounding).not.toBeNull();
|
|
15
|
-
|
|
16
|
-
await cell.click();
|
|
17
|
-
const selectionLine = page.locator('#editor1 .table-up-selection__line');
|
|
18
|
-
await expect(selectionLine).toBeVisible();
|
|
19
|
-
await page.mouse.down();
|
|
20
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 3, cellBounding.y + cellBounding.height / 2);
|
|
21
|
-
await page.mouse.up();
|
|
22
|
-
|
|
23
|
-
await expect(selectionLine).toBeVisible();
|
|
24
|
-
expect(
|
|
25
|
-
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).width)),
|
|
26
|
-
).toBeCloseTo(cellBounding.width * 3, -1);
|
|
27
|
-
expect(
|
|
28
|
-
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).height)),
|
|
29
|
-
).toBeCloseTo(cellBounding.height, -1);
|
|
30
|
-
|
|
31
|
-
await cell.click({ button: 'right' });
|
|
32
|
-
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge Cell' }).first().click();
|
|
33
|
-
|
|
34
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(3).click();
|
|
35
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(3).click();
|
|
36
|
-
await expect(selectionLine).toBeVisible();
|
|
37
|
-
await page.mouse.down();
|
|
38
|
-
await page.mouse.move(cellBounding.x + 10, cellBounding.y + 10);
|
|
39
|
-
await page.mouse.up();
|
|
40
|
-
|
|
41
|
-
const mergeCellBounding = (await page.locator('#editor1 .ql-editor .ql-table td').nth(0).boundingBox())!;
|
|
42
|
-
expect(mergeCellBounding).not.toBeNull();
|
|
43
|
-
expect(
|
|
44
|
-
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).width)),
|
|
45
|
-
).toBeCloseTo(mergeCellBounding.width, -1);
|
|
46
|
-
expect(
|
|
47
|
-
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).height)),
|
|
48
|
-
).toBeCloseTo(mergeCellBounding.height + cellBounding.height, -1);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('test TableSelection vertical', async ({ page }) => {
|
|
52
|
-
await createTableBySelect(page, 'container1', 5, 5);
|
|
53
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
54
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
55
|
-
expect(cellBounding).not.toBeNull();
|
|
56
|
-
await cell.click();
|
|
57
|
-
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
58
|
-
|
|
59
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
60
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
61
|
-
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
62
|
-
await page.mouse.down();
|
|
63
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 0.5, cellBounding.y + cellBounding.height * 3);
|
|
64
|
-
await page.mouse.up();
|
|
65
|
-
await cell.click({ button: 'right' });
|
|
66
|
-
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge Cell' }).first().click();
|
|
67
|
-
|
|
68
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
69
|
-
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
70
|
-
await page.mouse.down();
|
|
71
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 0.5);
|
|
72
|
-
await page.mouse.up();
|
|
73
|
-
|
|
74
|
-
expect(
|
|
75
|
-
Number.parseFloat(await page.locator('#editor1 .table-up-selection__line').evaluate(el => getComputedStyle(el).width)),
|
|
76
|
-
).toBeCloseTo(cellBounding.width * 2, -1);
|
|
77
|
-
expect(
|
|
78
|
-
Number.parseFloat(await page.locator('#editor1 .table-up-selection__line').evaluate(el => getComputedStyle(el).height)),
|
|
79
|
-
).toBeCloseTo(cellBounding.height * 3, -1);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('test TableSelection set format list', async ({ page }) => {
|
|
83
|
-
await createTableBySelect(page, 'container1', 2, 2);
|
|
84
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
85
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
86
|
-
expect(cellBounding).not.toBeNull();
|
|
87
|
-
await cell.click();
|
|
88
|
-
await page.mouse.down();
|
|
89
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 2 - 10, cellBounding.y + cellBounding.height * 2 - 10);
|
|
90
|
-
await page.mouse.up();
|
|
91
|
-
|
|
92
|
-
const item = page.locator('.ql-toolbar .ql-list[value="bullet"]').nth(0);
|
|
93
|
-
await item.click();
|
|
94
|
-
|
|
95
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner ol').count()).toBe(4);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('test TableSelection set indent format', async ({ page }) => {
|
|
99
|
-
await createTableBySelect(page, 'container1', 2, 2);
|
|
100
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
101
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
102
|
-
expect(cellBounding).not.toBeNull();
|
|
103
|
-
await cell.click();
|
|
104
|
-
await page.mouse.down();
|
|
105
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
106
|
-
await page.mouse.up();
|
|
107
|
-
|
|
108
|
-
const plus = page.locator('.ql-toolbar .ql-indent[value="+1"]').nth(0);
|
|
109
|
-
await plus.click();
|
|
110
|
-
await plus.click();
|
|
111
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner p.ql-indent-2').count()).toBe(4);
|
|
112
|
-
|
|
113
|
-
const reduce = page.locator('.ql-toolbar .ql-indent[value="-1"]').nth(0);
|
|
114
|
-
await reduce.click();
|
|
115
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner p.ql-indent-1').count()).toBe(4);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('test TableSelection set format header', async ({ page }) => {
|
|
119
|
-
await createTableBySelect(page, 'container1', 2, 2);
|
|
120
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
121
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
122
|
-
expect(cellBounding).not.toBeNull();
|
|
123
|
-
await cell.click();
|
|
124
|
-
await page.mouse.down();
|
|
125
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 2 - 10, cellBounding.y + cellBounding.height * 2 - 10);
|
|
126
|
-
await page.mouse.up();
|
|
127
|
-
|
|
128
|
-
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
129
|
-
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-options .ql-picker-item').nth(0).click();
|
|
130
|
-
|
|
131
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner h1').count()).toBe(4);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
extendTest('test TableSelection set multiple format', async ({ page, editorPage }) => {
|
|
135
|
-
editorPage.index = 0;
|
|
136
|
-
await editorPage.setContents([
|
|
137
|
-
{ insert: '\n' },
|
|
138
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
139
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
140
|
-
{ insert: '1' },
|
|
141
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
142
|
-
{ insert: '2' },
|
|
143
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
144
|
-
{ insert: '3' },
|
|
145
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
146
|
-
{ insert: '4' },
|
|
147
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
148
|
-
{ insert: '\n' },
|
|
149
|
-
]);
|
|
150
|
-
await page.waitForTimeout(1000);
|
|
151
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
152
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
153
|
-
expect(cellBounding).not.toBeNull();
|
|
154
|
-
await cell.click();
|
|
155
|
-
await page.mouse.down();
|
|
156
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
157
|
-
await page.mouse.up();
|
|
158
|
-
await editorPage.blur();
|
|
159
|
-
await editorPage.focus();
|
|
160
|
-
|
|
161
|
-
await page.locator('.ql-toolbar .ql-bold').nth(0).click();
|
|
162
|
-
await page.locator('.ql-toolbar .ql-italic').nth(0).click();
|
|
163
|
-
await page.locator('.ql-toolbar .ql-underline').nth(0).click();
|
|
164
|
-
await page.locator('.ql-toolbar .ql-strike').nth(0).click();
|
|
165
|
-
await page.locator('.ql-toolbar .ql-background.ql-picker').nth(0).click();
|
|
166
|
-
await page.locator('.ql-toolbar .ql-background.ql-picker .ql-picker-item[data-value="#e60000"]').nth(0).click();
|
|
167
|
-
|
|
168
|
-
const strongEl = page.locator('#editor1 .ql-table-cell-inner strong');
|
|
169
|
-
expect(await strongEl.count()).toBe(4);
|
|
170
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner em').count()).toBe(4);
|
|
171
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner s').count()).toBe(4);
|
|
172
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner u').count()).toBe(4);
|
|
173
|
-
await strongEl.all().then(async (elements) => {
|
|
174
|
-
for (const element of elements) {
|
|
175
|
-
await expect(element).toHaveCSS('background-color', 'rgb(230, 0, 0)');
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
test('test TableSelection clean format', async ({ page }) => {
|
|
181
|
-
await createTableBySelect(page, 'container1', 2, 2);
|
|
182
|
-
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
183
|
-
const cellBounding = (await cell.boundingBox())!;
|
|
184
|
-
expect(cellBounding).not.toBeNull();
|
|
185
|
-
await cell.click();
|
|
186
|
-
await page.mouse.down();
|
|
187
|
-
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
188
|
-
await page.mouse.up();
|
|
189
|
-
|
|
190
|
-
await page.locator('#container1 .ql-toolbar .ql-indent[value="+1"]').nth(0).click();
|
|
191
|
-
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
192
|
-
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-item[data-value="1"]').nth(0).click();
|
|
193
|
-
|
|
194
|
-
const formatEl = page.locator('#editor1 .ql-table-cell-inner h1.ql-indent-1');
|
|
195
|
-
expect(await formatEl.count()).toBe(4);
|
|
196
|
-
|
|
197
|
-
await page.locator('#container1 .ql-toolbar .ql-clean').nth(0).click();
|
|
198
|
-
const cleanEl = page.locator('#editor1 .ql-table-cell-inner h1.ql-indent-1');
|
|
199
|
-
expect(await cleanEl.count()).toBe(0);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
extendTest('test TableSelection set format in part of cell text', async ({ page, editorPage }) => {
|
|
203
|
-
editorPage.index = 0;
|
|
204
|
-
await editorPage.setContents([
|
|
205
|
-
{ insert: '\n' },
|
|
206
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
207
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
208
|
-
{ insert: '1' },
|
|
209
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
210
|
-
{ insert: '1' },
|
|
211
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
212
|
-
{ insert: '1' },
|
|
213
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
214
|
-
{ insert: '2' },
|
|
215
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
216
|
-
{ insert: '2' },
|
|
217
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
218
|
-
{ insert: '2' },
|
|
219
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
220
|
-
{ insert: '3' },
|
|
221
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
222
|
-
{ insert: '4' },
|
|
223
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
224
|
-
{ insert: '\n' },
|
|
225
|
-
]);
|
|
226
|
-
await page.waitForTimeout(1000);
|
|
227
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
228
|
-
|
|
229
|
-
await editorPage.setSelection(4, 0);
|
|
230
|
-
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
231
|
-
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-options .ql-picker-item').nth(0).click();
|
|
232
|
-
const selectionAfterHeader = await editorPage.getSelection();
|
|
233
|
-
expect(selectionAfterHeader).toEqual({ index: 4, length: 0 });
|
|
234
|
-
|
|
235
|
-
await editorPage.setSelection(6, 0);
|
|
236
|
-
await page.locator('.ql-toolbar .ql-list[value="bullet"]').nth(0).click();
|
|
237
|
-
const selectionAfterList = await editorPage.getSelection();
|
|
238
|
-
expect(selectionAfterList).toEqual({ index: 6, length: 0 });
|
|
239
|
-
|
|
240
|
-
await page.locator('#editor1 .ql-editor .ql-table td').nth(1).click();
|
|
241
|
-
await editorPage.setSelection(9, 3);
|
|
242
|
-
await page.locator('.ql-toolbar .ql-bold').nth(0).click();
|
|
243
|
-
await page.locator('.ql-toolbar .ql-italic').nth(0).click();
|
|
244
|
-
|
|
245
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner strong').count()).toBe(2);
|
|
246
|
-
expect(await page.locator('#editor1 .ql-table-cell-inner em').count()).toBe(2);
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
extendTest('test TableSelection should update when text change', async ({ page, editorPage }) => {
|
|
250
|
-
editorPage.index = 0;
|
|
251
|
-
await createTableBySelect(page, 'container1', 3, 3);
|
|
252
|
-
|
|
253
|
-
const lineBound = (await page.locator('#editor1 .ql-editor > p').first().boundingBox())!;
|
|
254
|
-
expect(lineBound).not.toBeNull();
|
|
255
|
-
|
|
256
|
-
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
257
|
-
const selectionWrapper = page.locator('#container1 .table-up-selection');
|
|
258
|
-
await expect(selectionWrapper).toBeVisible();
|
|
259
|
-
const selectionBound = (await selectionWrapper.boundingBox())!;
|
|
260
|
-
expect(selectionBound).not.toBeNull();
|
|
261
|
-
|
|
262
|
-
await editorPage.updateContents([{ insert: '12345\n12345' }], 'user');
|
|
263
|
-
|
|
264
|
-
await expect(selectionWrapper).toBeVisible();
|
|
265
|
-
const newSelectionWrapper = (await selectionWrapper.boundingBox())!;
|
|
266
|
-
expect(newSelectionWrapper).not.toBeNull();
|
|
267
|
-
expect(newSelectionWrapper.y - selectionBound.y).toBeCloseTo(lineBound.height, 5);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
extendTest('test TableSelection should hide if selectedTds no longer in page', async ({ page, editorPage }) => {
|
|
271
|
-
editorPage.index = 0;
|
|
272
|
-
await createTableBySelect(page, 'container1', 3, 3);
|
|
273
|
-
await page.waitForTimeout(1000);
|
|
274
|
-
|
|
275
|
-
const cell1Bound = (await page.locator('#editor1 .ql-editor td').nth(0).boundingBox())!;
|
|
276
|
-
expect(cell1Bound).not.toBeNull();
|
|
277
|
-
const cell5Bound = (await page.locator('#editor1 .ql-editor td').nth(4).boundingBox())!;
|
|
278
|
-
expect(cell5Bound).not.toBeNull();
|
|
279
|
-
|
|
280
|
-
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
281
|
-
await page.mouse.move(cell1Bound.x + cell1Bound.width / 2, cell1Bound.y + cell1Bound.height / 2);
|
|
282
|
-
await page.mouse.down();
|
|
283
|
-
await page.mouse.move(cell5Bound.x + cell5Bound.width / 2, cell5Bound.y + cell5Bound.height / 2);
|
|
284
|
-
await page.mouse.up();
|
|
285
|
-
await page.locator('#editor1 .ql-editor td').nth(4).click({ button: 'right' });
|
|
286
|
-
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge cell' }).first().click();
|
|
287
|
-
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
288
|
-
await page.waitForTimeout(1000);
|
|
289
|
-
|
|
290
|
-
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
291
|
-
await expect(selection).toBeVisible();
|
|
292
|
-
const selectionBound = (await selection.boundingBox())!;
|
|
293
|
-
expect(selectionBound).not.toBeNull();
|
|
294
|
-
const mergedCellBound = (await page.locator('#editor1 .ql-editor td').nth(0).boundingBox())!;
|
|
295
|
-
expect(mergedCellBound).not.toBeNull();
|
|
296
|
-
expect(selectionBound).toEqual(mergedCellBound);
|
|
297
|
-
|
|
298
|
-
await page.keyboard.press('Control+z');
|
|
299
|
-
await expect(page.locator('#container1 .table-up-selection .table-up-selection__line')).not.toBeVisible();
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
extendTest('test TableSelection should update when table resize', async ({ page, editorPage }) => {
|
|
303
|
-
editorPage.index = 0;
|
|
304
|
-
await createTableBySelect(page, 'container1', 3, 3);
|
|
305
|
-
|
|
306
|
-
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
307
|
-
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
308
|
-
await expect(selection).toBeVisible();
|
|
309
|
-
const selectionBound = (await selection.boundingBox())!;
|
|
310
|
-
expect(selectionBound).not.toBeNull();
|
|
311
|
-
|
|
312
|
-
await page.locator('#editor1').getByRole('cell').nth(4).click();
|
|
313
|
-
const colBoundingBox = (await page.locator('#editor1 .table-up-resize-line__col').boundingBox())!;
|
|
314
|
-
expect(colBoundingBox).not.toBeNull();
|
|
315
|
-
await page.mouse.move(colBoundingBox.x + colBoundingBox.width / 2, colBoundingBox.y + colBoundingBox.height / 2);
|
|
316
|
-
await page.mouse.down();
|
|
317
|
-
await page.mouse.move(colBoundingBox.x + colBoundingBox.width / 2 + 100, colBoundingBox.y + colBoundingBox.height / 2);
|
|
318
|
-
await page.mouse.up();
|
|
319
|
-
|
|
320
|
-
await expect(selection).toBeVisible();
|
|
321
|
-
const newSelectionBound = (await selection.boundingBox())!;
|
|
322
|
-
expect(newSelectionBound).not.toBeNull();
|
|
323
|
-
expect(newSelectionBound.width).toBeCloseTo(selectionBound.width + 100, 5);
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
extendTest('table resize should update TableSelection', async ({ page, editorPage }) => {
|
|
327
|
-
editorPage.index = 0;
|
|
328
|
-
await createTableBySelect(page, 'container1', 3, 3);
|
|
329
|
-
|
|
330
|
-
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
331
|
-
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
332
|
-
await page.locator('#editor1').getByRole('cell').nth(2).click();
|
|
333
|
-
await expect(selection).toBeVisible();
|
|
334
|
-
|
|
335
|
-
await editorPage.updateContents(
|
|
336
|
-
[
|
|
337
|
-
{ retain: 6 },
|
|
338
|
-
{ insert: { image: 'https://71f32f3f-ce5e-4222-95b1-a8f7b05ea469.mdnplay.dev/shared-assets/images/examples/grapefruit-slice.jpg' } },
|
|
339
|
-
],
|
|
340
|
-
);
|
|
341
|
-
await page.waitForSelector('#editor1 img');
|
|
342
|
-
|
|
343
|
-
const newThirdCellSelectionBound = (await selection.boundingBox())!;
|
|
344
|
-
expect(newThirdCellSelectionBound).not.toBeNull();
|
|
345
|
-
const newCellBound = (await page.locator('#editor1').getByRole('cell').nth(2).boundingBox())!;
|
|
346
|
-
expect(newCellBound).not.toBeNull();
|
|
347
|
-
expect(newThirdCellSelectionBound).toEqual(newCellBound);
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
extendTest('selection should be no offset when container have padding', async ({ page, editorPage }) => {
|
|
351
|
-
editorPage.index = 4;
|
|
352
|
-
await editorPage.setContents([
|
|
353
|
-
{ insert: '\n' },
|
|
354
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 300 } } },
|
|
355
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 300 } } },
|
|
356
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 300 } } },
|
|
357
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
358
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
359
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
360
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
361
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
362
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
363
|
-
{ insert: '\n' },
|
|
364
|
-
]);
|
|
365
|
-
|
|
366
|
-
const toolbox = page.locator('#editor5 .table-up-toolbox').nth(0);
|
|
367
|
-
await expect(toolbox).toHaveCSS('left', '20px');
|
|
368
|
-
await expect(toolbox).toHaveCSS('top', '20px');
|
|
369
|
-
|
|
370
|
-
await page.locator('#editor5 .ql-editor td').nth(0).click();
|
|
371
|
-
|
|
372
|
-
const tableBounding = (await page.locator('#editor5 .ql-editor .ql-table-wrapper').boundingBox())!;
|
|
373
|
-
const selectionBounding = (await page.locator('#editor5 .table-up-selection').boundingBox())!;
|
|
374
|
-
expect(tableBounding).not.toBeNull();
|
|
375
|
-
expect(selectionBounding).not.toBeNull();
|
|
376
|
-
expect(tableBounding.x).toBe(selectionBounding.x);
|
|
377
|
-
expect(tableBounding.y).toBe(selectionBounding.y);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
extendTest('toolbox bounds should same with quill.root', async ({ page, editorPage }) => {
|
|
381
|
-
editorPage.index = 4;
|
|
382
|
-
const toolbox = page.locator('#editor5 .table-up-toolbox').nth(0);
|
|
383
|
-
const quillRoot = page.locator('#editor5 .ql-editor').nth(0);
|
|
384
|
-
const toolboxBoundingBefore = (await toolbox.boundingBox())!;
|
|
385
|
-
const quillRootBoundingBefore = (await quillRoot.boundingBox())!;
|
|
386
|
-
expect(toolboxBoundingBefore).not.toBeNull();
|
|
387
|
-
expect(quillRootBoundingBefore).not.toBeNull();
|
|
388
|
-
expect(toolboxBoundingBefore).toEqual(quillRootBoundingBefore);
|
|
389
|
-
|
|
390
|
-
await editorPage.setContents([
|
|
391
|
-
{ insert: '\n' },
|
|
392
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 300 } } },
|
|
393
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 300 } } },
|
|
394
|
-
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 300 } } },
|
|
395
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
396
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
397
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
398
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
399
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
400
|
-
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
401
|
-
{ insert: '\n' },
|
|
402
|
-
]);
|
|
403
|
-
|
|
404
|
-
const toolboxBoundingAfter = (await toolbox.boundingBox())!;
|
|
405
|
-
const quillRootBoundingAfter = (await quillRoot.boundingBox())!;
|
|
406
|
-
expect(toolboxBoundingAfter).not.toBeNull();
|
|
407
|
-
expect(quillRootBoundingAfter).not.toBeNull();
|
|
408
|
-
expect(toolboxBoundingAfter).toEqual(quillRootBoundingAfter);
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
extendTest('TableSelection should not update when input composition', async ({ page, editorPage }) => {
|
|
412
|
-
editorPage.index = 0;
|
|
413
|
-
await createTableBySelect(page, 'container1', 3, 3);
|
|
414
|
-
|
|
415
|
-
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
416
|
-
const selectionLine = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
417
|
-
await expect(selectionLine).toBeVisible();
|
|
418
|
-
const bounding = (await selectionLine.boundingBox())!;
|
|
419
|
-
expect(bounding).not.toBeNull();
|
|
420
|
-
|
|
421
|
-
await page.dispatchEvent('#editor1 .ql-editor .ql-table-cell', 'compositionstart');
|
|
422
|
-
await page.type('#editor1 .ql-editor .ql-table-cell', 'zhongwen');
|
|
423
|
-
|
|
424
|
-
const composingBounding = (await selectionLine.boundingBox())!;
|
|
425
|
-
expect(composingBounding).toEqual(bounding);
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
extendTest.describe('TableSelection should work correct when wrapper scroll', () => {
|
|
429
|
-
extendTest('TableSelection in quill root scroll', async ({ page, editorPage }) => {
|
|
430
|
-
editorPage.index = 0;
|
|
431
|
-
await editorPage.setContents([
|
|
432
|
-
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
433
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'odojvz7psp8', full: false, width: 400 } } },
|
|
434
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'thtn1vm1a0l', full: false, width: 400 } } },
|
|
435
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6ci2o6ophk8', full: false, width: 400 } } },
|
|
436
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'k7jzkt8ede8', full: false, width: 400 } } },
|
|
437
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6nj5cy7mrat', full: false, width: 400 } } },
|
|
438
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
439
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
440
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
441
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
442
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
443
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
444
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
445
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
446
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
447
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
448
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
449
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
450
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
451
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
452
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
453
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
454
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
455
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
456
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
457
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
458
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
459
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
460
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
461
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
462
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
463
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
464
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
465
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
466
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
467
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
468
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
469
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
470
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
471
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
472
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
473
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
474
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
475
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
476
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
477
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
478
|
-
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
479
|
-
]);
|
|
480
|
-
await page.waitForTimeout(1000);
|
|
481
|
-
|
|
482
|
-
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
483
|
-
await page.mouse.down();
|
|
484
|
-
await page.mouse.wheel(0, 200);
|
|
485
|
-
await page.mouse.wheel(500, 0);
|
|
486
|
-
await page.waitForTimeout(1000);
|
|
487
|
-
const bounding = (await page.locator('#editor1 .ql-editor td').nth(12).boundingBox())!;
|
|
488
|
-
expect(bounding).not.toBeNull();
|
|
489
|
-
await page.mouse.move(bounding.x + bounding.width / 2, bounding.y + bounding.height / 2);
|
|
490
|
-
|
|
491
|
-
const selectedTds = await page.evaluate(() => {
|
|
492
|
-
return (window.quills[0].getModule('table-up') as any).getModule('table-selection')!.selectedTds;
|
|
493
|
-
});
|
|
494
|
-
expect(selectedTds.length).toBe(9);
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
extendTest('TableSelection in body scroll', async ({ page, editorPage }) => {
|
|
498
|
-
editorPage.index = 4;
|
|
499
|
-
await editorPage.setContents([
|
|
500
|
-
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
501
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'odojvz7psp8', full: false, width: 400 } } },
|
|
502
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'thtn1vm1a0l', full: false, width: 400 } } },
|
|
503
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6ci2o6ophk8', full: false, width: 400 } } },
|
|
504
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'k7jzkt8ede8', full: false, width: 400 } } },
|
|
505
|
-
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6nj5cy7mrat', full: false, width: 400 } } },
|
|
506
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
507
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
508
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
509
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
510
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
511
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
512
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
513
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
514
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
515
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
516
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
517
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
518
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
519
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
520
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
521
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
522
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
523
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
524
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
525
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
526
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
527
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
528
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
529
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
530
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
531
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
532
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
533
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
534
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
535
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
536
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
537
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
538
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
539
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
540
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
541
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
542
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
543
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
544
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
545
|
-
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
546
|
-
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
547
|
-
]);
|
|
548
|
-
await page.waitForTimeout(1000);
|
|
549
|
-
|
|
550
|
-
await page.locator('#editor5 .ql-editor td').nth(0).click();
|
|
551
|
-
await page.mouse.down();
|
|
552
|
-
await page.mouse.wheel(500, 200);
|
|
553
|
-
await page.waitForTimeout(1000);
|
|
554
|
-
const bounding = (await page.locator('#editor5 .ql-editor td').nth(12).boundingBox())!;
|
|
555
|
-
expect(bounding).not.toBeNull();
|
|
556
|
-
await page.mouse.move(bounding.x + bounding.width / 2, bounding.y + bounding.height / 2);
|
|
557
|
-
|
|
558
|
-
const selectedTds = await page.evaluate(() => {
|
|
559
|
-
return (window.quills[4].getModule('table-up') as any).getModule('table-selection')!.selectedTds;
|
|
560
|
-
});
|
|
561
|
-
expect(selectedTds.length).toBe(9);
|
|
562
|
-
});
|
|
563
|
-
});
|
|
1
|
+
import { expect, test } from '@playwright/test';
|
|
2
|
+
import { createTableBySelect, extendTest } from './utils';
|
|
3
|
+
|
|
4
|
+
test.beforeEach(async ({ page }) => {
|
|
5
|
+
await page.goto('http://127.0.0.1:5500/docs/test.html');
|
|
6
|
+
page.locator('.ql-container.ql-snow');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('test TableSelection horizontal', async ({ page }) => {
|
|
10
|
+
await createTableBySelect(page, 'container1', 5, 5);
|
|
11
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
12
|
+
await cell.click();
|
|
13
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
14
|
+
expect(cellBounding).not.toBeNull();
|
|
15
|
+
|
|
16
|
+
await cell.click();
|
|
17
|
+
const selectionLine = page.locator('#editor1 .table-up-selection__line');
|
|
18
|
+
await expect(selectionLine).toBeVisible();
|
|
19
|
+
await page.mouse.down();
|
|
20
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 3, cellBounding.y + cellBounding.height / 2);
|
|
21
|
+
await page.mouse.up();
|
|
22
|
+
|
|
23
|
+
await expect(selectionLine).toBeVisible();
|
|
24
|
+
expect(
|
|
25
|
+
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).width)),
|
|
26
|
+
).toBeCloseTo(cellBounding.width * 3, -1);
|
|
27
|
+
expect(
|
|
28
|
+
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).height)),
|
|
29
|
+
).toBeCloseTo(cellBounding.height, -1);
|
|
30
|
+
|
|
31
|
+
await cell.click({ button: 'right' });
|
|
32
|
+
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge Cell' }).first().click();
|
|
33
|
+
|
|
34
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(3).click();
|
|
35
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(3).click();
|
|
36
|
+
await expect(selectionLine).toBeVisible();
|
|
37
|
+
await page.mouse.down();
|
|
38
|
+
await page.mouse.move(cellBounding.x + 10, cellBounding.y + 10);
|
|
39
|
+
await page.mouse.up();
|
|
40
|
+
|
|
41
|
+
const mergeCellBounding = (await page.locator('#editor1 .ql-editor .ql-table td').nth(0).boundingBox())!;
|
|
42
|
+
expect(mergeCellBounding).not.toBeNull();
|
|
43
|
+
expect(
|
|
44
|
+
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).width)),
|
|
45
|
+
).toBeCloseTo(mergeCellBounding.width, -1);
|
|
46
|
+
expect(
|
|
47
|
+
Number.parseFloat(await selectionLine.evaluate(el => getComputedStyle(el).height)),
|
|
48
|
+
).toBeCloseTo(mergeCellBounding.height + cellBounding.height, -1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('test TableSelection vertical', async ({ page }) => {
|
|
52
|
+
await createTableBySelect(page, 'container1', 5, 5);
|
|
53
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
54
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
55
|
+
expect(cellBounding).not.toBeNull();
|
|
56
|
+
await cell.click();
|
|
57
|
+
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
58
|
+
|
|
59
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
60
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
61
|
+
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
62
|
+
await page.mouse.down();
|
|
63
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 0.5, cellBounding.y + cellBounding.height * 3);
|
|
64
|
+
await page.mouse.up();
|
|
65
|
+
await cell.click({ button: 'right' });
|
|
66
|
+
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge Cell' }).first().click();
|
|
67
|
+
|
|
68
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
69
|
+
await expect(page.locator('#editor1 .table-up-selection__line')).toBeVisible();
|
|
70
|
+
await page.mouse.down();
|
|
71
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 0.5);
|
|
72
|
+
await page.mouse.up();
|
|
73
|
+
|
|
74
|
+
expect(
|
|
75
|
+
Number.parseFloat(await page.locator('#editor1 .table-up-selection__line').evaluate(el => getComputedStyle(el).width)),
|
|
76
|
+
).toBeCloseTo(cellBounding.width * 2, -1);
|
|
77
|
+
expect(
|
|
78
|
+
Number.parseFloat(await page.locator('#editor1 .table-up-selection__line').evaluate(el => getComputedStyle(el).height)),
|
|
79
|
+
).toBeCloseTo(cellBounding.height * 3, -1);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('test TableSelection set format list', async ({ page }) => {
|
|
83
|
+
await createTableBySelect(page, 'container1', 2, 2);
|
|
84
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
85
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
86
|
+
expect(cellBounding).not.toBeNull();
|
|
87
|
+
await cell.click();
|
|
88
|
+
await page.mouse.down();
|
|
89
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 2 - 10, cellBounding.y + cellBounding.height * 2 - 10);
|
|
90
|
+
await page.mouse.up();
|
|
91
|
+
|
|
92
|
+
const item = page.locator('.ql-toolbar .ql-list[value="bullet"]').nth(0);
|
|
93
|
+
await item.click();
|
|
94
|
+
|
|
95
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner ol').count()).toBe(4);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('test TableSelection set indent format', async ({ page }) => {
|
|
99
|
+
await createTableBySelect(page, 'container1', 2, 2);
|
|
100
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
101
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
102
|
+
expect(cellBounding).not.toBeNull();
|
|
103
|
+
await cell.click();
|
|
104
|
+
await page.mouse.down();
|
|
105
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
106
|
+
await page.mouse.up();
|
|
107
|
+
|
|
108
|
+
const plus = page.locator('.ql-toolbar .ql-indent[value="+1"]').nth(0);
|
|
109
|
+
await plus.click();
|
|
110
|
+
await plus.click();
|
|
111
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner p.ql-indent-2').count()).toBe(4);
|
|
112
|
+
|
|
113
|
+
const reduce = page.locator('.ql-toolbar .ql-indent[value="-1"]').nth(0);
|
|
114
|
+
await reduce.click();
|
|
115
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner p.ql-indent-1').count()).toBe(4);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('test TableSelection set format header', async ({ page }) => {
|
|
119
|
+
await createTableBySelect(page, 'container1', 2, 2);
|
|
120
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
121
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
122
|
+
expect(cellBounding).not.toBeNull();
|
|
123
|
+
await cell.click();
|
|
124
|
+
await page.mouse.down();
|
|
125
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 2 - 10, cellBounding.y + cellBounding.height * 2 - 10);
|
|
126
|
+
await page.mouse.up();
|
|
127
|
+
|
|
128
|
+
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
129
|
+
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-options .ql-picker-item').nth(0).click();
|
|
130
|
+
|
|
131
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner h1').count()).toBe(4);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
extendTest('test TableSelection set multiple format', async ({ page, editorPage }) => {
|
|
135
|
+
editorPage.index = 0;
|
|
136
|
+
await editorPage.setContents([
|
|
137
|
+
{ insert: '\n' },
|
|
138
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
139
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
140
|
+
{ insert: '1' },
|
|
141
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
142
|
+
{ insert: '2' },
|
|
143
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
144
|
+
{ insert: '3' },
|
|
145
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
146
|
+
{ insert: '4' },
|
|
147
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
148
|
+
{ insert: '\n' },
|
|
149
|
+
]);
|
|
150
|
+
await page.waitForTimeout(1000);
|
|
151
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
152
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
153
|
+
expect(cellBounding).not.toBeNull();
|
|
154
|
+
await cell.click();
|
|
155
|
+
await page.mouse.down();
|
|
156
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
157
|
+
await page.mouse.up();
|
|
158
|
+
await editorPage.blur();
|
|
159
|
+
await editorPage.focus();
|
|
160
|
+
|
|
161
|
+
await page.locator('.ql-toolbar .ql-bold').nth(0).click();
|
|
162
|
+
await page.locator('.ql-toolbar .ql-italic').nth(0).click();
|
|
163
|
+
await page.locator('.ql-toolbar .ql-underline').nth(0).click();
|
|
164
|
+
await page.locator('.ql-toolbar .ql-strike').nth(0).click();
|
|
165
|
+
await page.locator('.ql-toolbar .ql-background.ql-picker').nth(0).click();
|
|
166
|
+
await page.locator('.ql-toolbar .ql-background.ql-picker .ql-picker-item[data-value="#e60000"]').nth(0).click();
|
|
167
|
+
|
|
168
|
+
const strongEl = page.locator('#editor1 .ql-table-cell-inner strong');
|
|
169
|
+
expect(await strongEl.count()).toBe(4);
|
|
170
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner em').count()).toBe(4);
|
|
171
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner s').count()).toBe(4);
|
|
172
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner u').count()).toBe(4);
|
|
173
|
+
await strongEl.all().then(async (elements) => {
|
|
174
|
+
for (const element of elements) {
|
|
175
|
+
await expect(element).toHaveCSS('background-color', 'rgb(230, 0, 0)');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('test TableSelection clean format', async ({ page }) => {
|
|
181
|
+
await createTableBySelect(page, 'container1', 2, 2);
|
|
182
|
+
const cell = page.locator('#editor1 .ql-editor .ql-table td').nth(0);
|
|
183
|
+
const cellBounding = (await cell.boundingBox())!;
|
|
184
|
+
expect(cellBounding).not.toBeNull();
|
|
185
|
+
await cell.click();
|
|
186
|
+
await page.mouse.down();
|
|
187
|
+
await page.mouse.move(cellBounding.x + cellBounding.width * 1.5, cellBounding.y + cellBounding.height * 1.5);
|
|
188
|
+
await page.mouse.up();
|
|
189
|
+
|
|
190
|
+
await page.locator('#container1 .ql-toolbar .ql-indent[value="+1"]').nth(0).click();
|
|
191
|
+
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
192
|
+
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-item[data-value="1"]').nth(0).click();
|
|
193
|
+
|
|
194
|
+
const formatEl = page.locator('#editor1 .ql-table-cell-inner h1.ql-indent-1');
|
|
195
|
+
expect(await formatEl.count()).toBe(4);
|
|
196
|
+
|
|
197
|
+
await page.locator('#container1 .ql-toolbar .ql-clean').nth(0).click();
|
|
198
|
+
const cleanEl = page.locator('#editor1 .ql-table-cell-inner h1.ql-indent-1');
|
|
199
|
+
expect(await cleanEl.count()).toBe(0);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
extendTest('test TableSelection set format in part of cell text', async ({ page, editorPage }) => {
|
|
203
|
+
editorPage.index = 0;
|
|
204
|
+
await editorPage.setContents([
|
|
205
|
+
{ insert: '\n' },
|
|
206
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 100 } } },
|
|
207
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 100 } } },
|
|
208
|
+
{ insert: '1' },
|
|
209
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
210
|
+
{ insert: '1' },
|
|
211
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
212
|
+
{ insert: '1' },
|
|
213
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
214
|
+
{ insert: '2' },
|
|
215
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
216
|
+
{ insert: '2' },
|
|
217
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
218
|
+
{ insert: '2' },
|
|
219
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
220
|
+
{ insert: '3' },
|
|
221
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
222
|
+
{ insert: '4' },
|
|
223
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
224
|
+
{ insert: '\n' },
|
|
225
|
+
]);
|
|
226
|
+
await page.waitForTimeout(1000);
|
|
227
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(0).click();
|
|
228
|
+
|
|
229
|
+
await editorPage.setSelection(4, 0);
|
|
230
|
+
await page.locator('#container1 .ql-toolbar .ql-header').nth(0).click();
|
|
231
|
+
await page.locator('#container1 .ql-toolbar .ql-header .ql-picker-options .ql-picker-item').nth(0).click();
|
|
232
|
+
const selectionAfterHeader = await editorPage.getSelection();
|
|
233
|
+
expect(selectionAfterHeader).toEqual({ index: 4, length: 0 });
|
|
234
|
+
|
|
235
|
+
await editorPage.setSelection(6, 0);
|
|
236
|
+
await page.locator('.ql-toolbar .ql-list[value="bullet"]').nth(0).click();
|
|
237
|
+
const selectionAfterList = await editorPage.getSelection();
|
|
238
|
+
expect(selectionAfterList).toEqual({ index: 6, length: 0 });
|
|
239
|
+
|
|
240
|
+
await page.locator('#editor1 .ql-editor .ql-table td').nth(1).click();
|
|
241
|
+
await editorPage.setSelection(9, 3);
|
|
242
|
+
await page.locator('.ql-toolbar .ql-bold').nth(0).click();
|
|
243
|
+
await page.locator('.ql-toolbar .ql-italic').nth(0).click();
|
|
244
|
+
|
|
245
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner strong').count()).toBe(2);
|
|
246
|
+
expect(await page.locator('#editor1 .ql-table-cell-inner em').count()).toBe(2);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
extendTest('test TableSelection should update when text change', async ({ page, editorPage }) => {
|
|
250
|
+
editorPage.index = 0;
|
|
251
|
+
await createTableBySelect(page, 'container1', 3, 3);
|
|
252
|
+
|
|
253
|
+
const lineBound = (await page.locator('#editor1 .ql-editor > p').first().boundingBox())!;
|
|
254
|
+
expect(lineBound).not.toBeNull();
|
|
255
|
+
|
|
256
|
+
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
257
|
+
const selectionWrapper = page.locator('#container1 .table-up-selection');
|
|
258
|
+
await expect(selectionWrapper).toBeVisible();
|
|
259
|
+
const selectionBound = (await selectionWrapper.boundingBox())!;
|
|
260
|
+
expect(selectionBound).not.toBeNull();
|
|
261
|
+
|
|
262
|
+
await editorPage.updateContents([{ insert: '12345\n12345' }], 'user');
|
|
263
|
+
|
|
264
|
+
await expect(selectionWrapper).toBeVisible();
|
|
265
|
+
const newSelectionWrapper = (await selectionWrapper.boundingBox())!;
|
|
266
|
+
expect(newSelectionWrapper).not.toBeNull();
|
|
267
|
+
expect(newSelectionWrapper.y - selectionBound.y).toBeCloseTo(lineBound.height, 5);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
extendTest('test TableSelection should hide if selectedTds no longer in page', async ({ page, editorPage }) => {
|
|
271
|
+
editorPage.index = 0;
|
|
272
|
+
await createTableBySelect(page, 'container1', 3, 3);
|
|
273
|
+
await page.waitForTimeout(1000);
|
|
274
|
+
|
|
275
|
+
const cell1Bound = (await page.locator('#editor1 .ql-editor td').nth(0).boundingBox())!;
|
|
276
|
+
expect(cell1Bound).not.toBeNull();
|
|
277
|
+
const cell5Bound = (await page.locator('#editor1 .ql-editor td').nth(4).boundingBox())!;
|
|
278
|
+
expect(cell5Bound).not.toBeNull();
|
|
279
|
+
|
|
280
|
+
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
281
|
+
await page.mouse.move(cell1Bound.x + cell1Bound.width / 2, cell1Bound.y + cell1Bound.height / 2);
|
|
282
|
+
await page.mouse.down();
|
|
283
|
+
await page.mouse.move(cell5Bound.x + cell5Bound.width / 2, cell5Bound.y + cell5Bound.height / 2);
|
|
284
|
+
await page.mouse.up();
|
|
285
|
+
await page.locator('#editor1 .ql-editor td').nth(4).click({ button: 'right' });
|
|
286
|
+
await page.locator('.table-up-menu.is-contextmenu .table-up-menu__item').filter({ hasText: 'Merge cell' }).first().click();
|
|
287
|
+
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
288
|
+
await page.waitForTimeout(1000);
|
|
289
|
+
|
|
290
|
+
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
291
|
+
await expect(selection).toBeVisible();
|
|
292
|
+
const selectionBound = (await selection.boundingBox())!;
|
|
293
|
+
expect(selectionBound).not.toBeNull();
|
|
294
|
+
const mergedCellBound = (await page.locator('#editor1 .ql-editor td').nth(0).boundingBox())!;
|
|
295
|
+
expect(mergedCellBound).not.toBeNull();
|
|
296
|
+
expect(selectionBound).toEqual(mergedCellBound);
|
|
297
|
+
|
|
298
|
+
await page.keyboard.press('Control+z');
|
|
299
|
+
await expect(page.locator('#container1 .table-up-selection .table-up-selection__line')).not.toBeVisible();
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
extendTest('test TableSelection should update when table resize', async ({ page, editorPage }) => {
|
|
303
|
+
editorPage.index = 0;
|
|
304
|
+
await createTableBySelect(page, 'container1', 3, 3);
|
|
305
|
+
|
|
306
|
+
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
307
|
+
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
308
|
+
await expect(selection).toBeVisible();
|
|
309
|
+
const selectionBound = (await selection.boundingBox())!;
|
|
310
|
+
expect(selectionBound).not.toBeNull();
|
|
311
|
+
|
|
312
|
+
await page.locator('#editor1').getByRole('cell').nth(4).click();
|
|
313
|
+
const colBoundingBox = (await page.locator('#editor1 .table-up-resize-line__col').boundingBox())!;
|
|
314
|
+
expect(colBoundingBox).not.toBeNull();
|
|
315
|
+
await page.mouse.move(colBoundingBox.x + colBoundingBox.width / 2, colBoundingBox.y + colBoundingBox.height / 2);
|
|
316
|
+
await page.mouse.down();
|
|
317
|
+
await page.mouse.move(colBoundingBox.x + colBoundingBox.width / 2 + 100, colBoundingBox.y + colBoundingBox.height / 2);
|
|
318
|
+
await page.mouse.up();
|
|
319
|
+
|
|
320
|
+
await expect(selection).toBeVisible();
|
|
321
|
+
const newSelectionBound = (await selection.boundingBox())!;
|
|
322
|
+
expect(newSelectionBound).not.toBeNull();
|
|
323
|
+
expect(newSelectionBound.width).toBeCloseTo(selectionBound.width + 100, 5);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
extendTest('table resize should update TableSelection', async ({ page, editorPage }) => {
|
|
327
|
+
editorPage.index = 0;
|
|
328
|
+
await createTableBySelect(page, 'container1', 3, 3);
|
|
329
|
+
|
|
330
|
+
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
331
|
+
const selection = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
332
|
+
await page.locator('#editor1').getByRole('cell').nth(2).click();
|
|
333
|
+
await expect(selection).toBeVisible();
|
|
334
|
+
|
|
335
|
+
await editorPage.updateContents(
|
|
336
|
+
[
|
|
337
|
+
{ retain: 6 },
|
|
338
|
+
{ insert: { image: 'https://71f32f3f-ce5e-4222-95b1-a8f7b05ea469.mdnplay.dev/shared-assets/images/examples/grapefruit-slice.jpg' } },
|
|
339
|
+
],
|
|
340
|
+
);
|
|
341
|
+
await page.waitForSelector('#editor1 img');
|
|
342
|
+
|
|
343
|
+
const newThirdCellSelectionBound = (await selection.boundingBox())!;
|
|
344
|
+
expect(newThirdCellSelectionBound).not.toBeNull();
|
|
345
|
+
const newCellBound = (await page.locator('#editor1').getByRole('cell').nth(2).boundingBox())!;
|
|
346
|
+
expect(newCellBound).not.toBeNull();
|
|
347
|
+
expect(newThirdCellSelectionBound).toEqual(newCellBound);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
extendTest('selection should be no offset when container have padding', async ({ page, editorPage }) => {
|
|
351
|
+
editorPage.index = 4;
|
|
352
|
+
await editorPage.setContents([
|
|
353
|
+
{ insert: '\n' },
|
|
354
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 300 } } },
|
|
355
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 300 } } },
|
|
356
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 300 } } },
|
|
357
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
358
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
359
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
360
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
361
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
362
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
363
|
+
{ insert: '\n' },
|
|
364
|
+
]);
|
|
365
|
+
|
|
366
|
+
const toolbox = page.locator('#editor5 .table-up-toolbox').nth(0);
|
|
367
|
+
await expect(toolbox).toHaveCSS('left', '20px');
|
|
368
|
+
await expect(toolbox).toHaveCSS('top', '20px');
|
|
369
|
+
|
|
370
|
+
await page.locator('#editor5 .ql-editor td').nth(0).click();
|
|
371
|
+
|
|
372
|
+
const tableBounding = (await page.locator('#editor5 .ql-editor .ql-table-wrapper').boundingBox())!;
|
|
373
|
+
const selectionBounding = (await page.locator('#editor5 .table-up-selection').boundingBox())!;
|
|
374
|
+
expect(tableBounding).not.toBeNull();
|
|
375
|
+
expect(selectionBounding).not.toBeNull();
|
|
376
|
+
expect(tableBounding.x).toBe(selectionBounding.x);
|
|
377
|
+
expect(tableBounding.y).toBe(selectionBounding.y);
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
extendTest('toolbox bounds should same with quill.root', async ({ page, editorPage }) => {
|
|
381
|
+
editorPage.index = 4;
|
|
382
|
+
const toolbox = page.locator('#editor5 .table-up-toolbox').nth(0);
|
|
383
|
+
const quillRoot = page.locator('#editor5 .ql-editor').nth(0);
|
|
384
|
+
const toolboxBoundingBefore = (await toolbox.boundingBox())!;
|
|
385
|
+
const quillRootBoundingBefore = (await quillRoot.boundingBox())!;
|
|
386
|
+
expect(toolboxBoundingBefore).not.toBeNull();
|
|
387
|
+
expect(quillRootBoundingBefore).not.toBeNull();
|
|
388
|
+
expect(toolboxBoundingBefore).toEqual(quillRootBoundingBefore);
|
|
389
|
+
|
|
390
|
+
await editorPage.setContents([
|
|
391
|
+
{ insert: '\n' },
|
|
392
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '1', full: false, width: 300 } } },
|
|
393
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '2', full: false, width: 300 } } },
|
|
394
|
+
{ insert: { 'table-up-col': { tableId: '1', colId: '3', full: false, width: 300 } } },
|
|
395
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
396
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
397
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '1', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
398
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '1', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
399
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '2', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
400
|
+
{ attributes: { 'table-up-cell-inner': { tableId: '1', rowId: '2', colId: '3', rowspan: 1, colspan: 1 } }, insert: '\n' },
|
|
401
|
+
{ insert: '\n' },
|
|
402
|
+
]);
|
|
403
|
+
|
|
404
|
+
const toolboxBoundingAfter = (await toolbox.boundingBox())!;
|
|
405
|
+
const quillRootBoundingAfter = (await quillRoot.boundingBox())!;
|
|
406
|
+
expect(toolboxBoundingAfter).not.toBeNull();
|
|
407
|
+
expect(quillRootBoundingAfter).not.toBeNull();
|
|
408
|
+
expect(toolboxBoundingAfter).toEqual(quillRootBoundingAfter);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
extendTest('TableSelection should not update when input composition', async ({ page, editorPage }) => {
|
|
412
|
+
editorPage.index = 0;
|
|
413
|
+
await createTableBySelect(page, 'container1', 3, 3);
|
|
414
|
+
|
|
415
|
+
await page.locator('#editor1 .ql-table .ql-table-cell').nth(0).click();
|
|
416
|
+
const selectionLine = page.locator('#container1 .table-up-selection .table-up-selection__line');
|
|
417
|
+
await expect(selectionLine).toBeVisible();
|
|
418
|
+
const bounding = (await selectionLine.boundingBox())!;
|
|
419
|
+
expect(bounding).not.toBeNull();
|
|
420
|
+
|
|
421
|
+
await page.dispatchEvent('#editor1 .ql-editor .ql-table-cell', 'compositionstart');
|
|
422
|
+
await page.type('#editor1 .ql-editor .ql-table-cell', 'zhongwen');
|
|
423
|
+
|
|
424
|
+
const composingBounding = (await selectionLine.boundingBox())!;
|
|
425
|
+
expect(composingBounding).toEqual(bounding);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
extendTest.describe('TableSelection should work correct when wrapper scroll', () => {
|
|
429
|
+
extendTest('TableSelection in quill root scroll', async ({ page, editorPage }) => {
|
|
430
|
+
editorPage.index = 0;
|
|
431
|
+
await editorPage.setContents([
|
|
432
|
+
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
433
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'odojvz7psp8', full: false, width: 400 } } },
|
|
434
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'thtn1vm1a0l', full: false, width: 400 } } },
|
|
435
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6ci2o6ophk8', full: false, width: 400 } } },
|
|
436
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'k7jzkt8ede8', full: false, width: 400 } } },
|
|
437
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6nj5cy7mrat', full: false, width: 400 } } },
|
|
438
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
439
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
440
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
441
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
442
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
443
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
444
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
445
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
446
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
447
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
448
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
449
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
450
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
451
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
452
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
453
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
454
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
455
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
456
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
457
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
458
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
459
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
460
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
461
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
462
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
463
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
464
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
465
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
466
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
467
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
468
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
469
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
470
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
471
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
472
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
473
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
474
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
475
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
476
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
477
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
478
|
+
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
479
|
+
]);
|
|
480
|
+
await page.waitForTimeout(1000);
|
|
481
|
+
|
|
482
|
+
await page.locator('#editor1 .ql-editor td').nth(0).click();
|
|
483
|
+
await page.mouse.down();
|
|
484
|
+
await page.mouse.wheel(0, 200);
|
|
485
|
+
await page.mouse.wheel(500, 0);
|
|
486
|
+
await page.waitForTimeout(1000);
|
|
487
|
+
const bounding = (await page.locator('#editor1 .ql-editor td').nth(12).boundingBox())!;
|
|
488
|
+
expect(bounding).not.toBeNull();
|
|
489
|
+
await page.mouse.move(bounding.x + bounding.width / 2, bounding.y + bounding.height / 2);
|
|
490
|
+
|
|
491
|
+
const selectedTds = await page.evaluate(() => {
|
|
492
|
+
return (window.quills[0].getModule('table-up') as any).getModule('table-selection')!.selectedTds;
|
|
493
|
+
});
|
|
494
|
+
expect(selectedTds.length).toBe(9);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
extendTest('TableSelection in body scroll', async ({ page, editorPage }) => {
|
|
498
|
+
editorPage.index = 4;
|
|
499
|
+
await editorPage.setContents([
|
|
500
|
+
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
501
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'odojvz7psp8', full: false, width: 400 } } },
|
|
502
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'thtn1vm1a0l', full: false, width: 400 } } },
|
|
503
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6ci2o6ophk8', full: false, width: 400 } } },
|
|
504
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: 'k7jzkt8ede8', full: false, width: 400 } } },
|
|
505
|
+
{ insert: { 'table-up-col': { tableId: 'q9rcu2l5en', colId: '6nj5cy7mrat', full: false, width: 400 } } },
|
|
506
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
507
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
508
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
509
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
510
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: '1zdvvq78kqa', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
511
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
512
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
513
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
514
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
515
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'kkyehoxutvs', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
516
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
517
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
518
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
519
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
520
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'ife4q2in0se', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
521
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
522
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
523
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
524
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
525
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'waafccgk7yk', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
526
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
527
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
528
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
529
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
530
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'lb7s1smtyh', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
531
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
532
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
533
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
534
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
535
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'jgvhoknv7tf', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
536
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
537
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
538
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
539
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
540
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'bxqnf58tmfd', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
541
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'odojvz7psp8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
542
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'thtn1vm1a0l', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
543
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6ci2o6ophk8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
544
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: 'k7jzkt8ede8', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
545
|
+
{ attributes: { 'table-up-cell-inner': { tableId: 'q9rcu2l5en', rowId: 'dctaip1l39v', colId: '6nj5cy7mrat', rowspan: 1, colspan: 1, style: 'height: 100px;' } }, insert: '\n' },
|
|
546
|
+
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n' },
|
|
547
|
+
]);
|
|
548
|
+
await page.waitForTimeout(1000);
|
|
549
|
+
|
|
550
|
+
await page.locator('#editor5 .ql-editor td').nth(0).click();
|
|
551
|
+
await page.mouse.down();
|
|
552
|
+
await page.mouse.wheel(500, 200);
|
|
553
|
+
await page.waitForTimeout(1000);
|
|
554
|
+
const bounding = (await page.locator('#editor5 .ql-editor td').nth(12).boundingBox())!;
|
|
555
|
+
expect(bounding).not.toBeNull();
|
|
556
|
+
await page.mouse.move(bounding.x + bounding.width / 2, bounding.y + bounding.height / 2);
|
|
557
|
+
|
|
558
|
+
const selectedTds = await page.evaluate(() => {
|
|
559
|
+
return (window.quills[4].getModule('table-up') as any).getModule('table-selection')!.selectedTds;
|
|
560
|
+
});
|
|
561
|
+
expect(selectedTds.length).toBe(9);
|
|
562
|
+
});
|
|
563
|
+
});
|