@atlaskit/editor-plugin-table 5.3.21 → 5.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/__tests__/integration/__snapshots__/delete-rows.ts.snap +0 -962
- package/src/__tests__/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -101
- package/src/__tests__/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -505
- package/src/__tests__/integration/__snapshots__/even-columns.ts.snap +0 -647
- package/src/__tests__/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -173
- package/src/__tests__/integration/__snapshots__/layout.ts.snap +0 -1654
- package/src/__tests__/integration/delete-rows.ts +0 -127
- package/src/__tests__/integration/delete-table-when-selected.ts +0 -112
- package/src/__tests__/integration/deleting-empty-paragraph-under-table.ts +0 -89
- package/src/__tests__/integration/even-columns.ts +0 -75
- package/src/__tests__/integration/insert-cell-header-with-strong-mark.ts +0 -41
- package/src/__tests__/integration/insert-long-smart-link.ts +0 -66
- package/src/__tests__/integration/layout.ts +0 -219
- package/src/__tests__/integration/resize-handler.ts +0 -104
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
2
|
-
import {
|
|
3
|
-
animationFrame,
|
|
4
|
-
changeSelectedNodeLayout,
|
|
5
|
-
editable,
|
|
6
|
-
fullpage,
|
|
7
|
-
getDocFromElement,
|
|
8
|
-
toggleBreakout,
|
|
9
|
-
} from '@atlaskit/editor-test-helpers/integration/helpers';
|
|
10
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
11
|
-
import { clickFirstCell } from '@atlaskit/editor-test-helpers/page-objects/table';
|
|
12
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
13
|
-
import {
|
|
14
|
-
goToEditorTestingWDExample,
|
|
15
|
-
mountEditor,
|
|
16
|
-
} from '@atlaskit/editor-test-helpers/testing-example-page';
|
|
17
|
-
import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
defaultTableInOverflow,
|
|
21
|
-
defaultTableResizedTable,
|
|
22
|
-
nestedTables,
|
|
23
|
-
} from './__fixtures__/layout-documents';
|
|
24
|
-
|
|
25
|
-
BrowserTestCase(
|
|
26
|
-
'Avoid overflow when table scale to wide',
|
|
27
|
-
{ skip: ['safari', 'firefox'] },
|
|
28
|
-
async (client: any, testName: string) => {
|
|
29
|
-
const page = await goToEditorTestingWDExample(
|
|
30
|
-
client,
|
|
31
|
-
'editor-plugin-table',
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
await mountEditor(page, {
|
|
35
|
-
appearance: fullpage.appearance,
|
|
36
|
-
defaultValue: JSON.stringify(defaultTableInOverflow),
|
|
37
|
-
allowTables: {
|
|
38
|
-
advanced: true,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
await clickFirstCell(page);
|
|
43
|
-
await toggleBreakout(page, 1);
|
|
44
|
-
|
|
45
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
46
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
47
|
-
},
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
BrowserTestCase(
|
|
51
|
-
'Avoid overflow when table scale to full width',
|
|
52
|
-
{ skip: ['safari', 'firefox'] },
|
|
53
|
-
async (client: any, testName: string) => {
|
|
54
|
-
const page = await goToEditorTestingWDExample(
|
|
55
|
-
client,
|
|
56
|
-
'editor-plugin-table',
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
await mountEditor(page, {
|
|
60
|
-
appearance: fullpage.appearance,
|
|
61
|
-
defaultValue: JSON.stringify(defaultTableInOverflow),
|
|
62
|
-
allowTables: {
|
|
63
|
-
advanced: true,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
await clickFirstCell(page);
|
|
68
|
-
await toggleBreakout(page, 2);
|
|
69
|
-
|
|
70
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
71
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
72
|
-
},
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
BrowserTestCase(
|
|
76
|
-
'Maintains the wide layout size without overflow',
|
|
77
|
-
{ skip: ['firefox', 'safari'] },
|
|
78
|
-
async (client: any, testName: string) => {
|
|
79
|
-
const page = await goToEditorTestingWDExample(
|
|
80
|
-
client,
|
|
81
|
-
'editor-plugin-table',
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
await mountEditor(page, {
|
|
85
|
-
appearance: fullpage.appearance,
|
|
86
|
-
defaultValue: JSON.stringify(defaultTableResizedTable),
|
|
87
|
-
allowTables: {
|
|
88
|
-
advanced: true,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
await clickFirstCell(page);
|
|
93
|
-
await toggleBreakout(page, 1);
|
|
94
|
-
|
|
95
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
96
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
BrowserTestCase(
|
|
101
|
-
'Maintains the full-width layout size without overflow',
|
|
102
|
-
{ skip: ['firefox', 'safari'] },
|
|
103
|
-
async (client: any, testName: string) => {
|
|
104
|
-
const page = await goToEditorTestingWDExample(
|
|
105
|
-
client,
|
|
106
|
-
'editor-plugin-table',
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
await mountEditor(page, {
|
|
110
|
-
appearance: fullpage.appearance,
|
|
111
|
-
defaultValue: JSON.stringify(defaultTableResizedTable),
|
|
112
|
-
allowTables: {
|
|
113
|
-
advanced: true,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
await clickFirstCell(page);
|
|
118
|
-
await toggleBreakout(page, 2);
|
|
119
|
-
|
|
120
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
121
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
122
|
-
},
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
BrowserTestCase(
|
|
126
|
-
'Maintains the default layout size without overflow when toggling through layouts',
|
|
127
|
-
{ skip: ['safari', 'firefox'] },
|
|
128
|
-
async (client: any, testName: string) => {
|
|
129
|
-
const page = await goToEditorTestingWDExample(
|
|
130
|
-
client,
|
|
131
|
-
'editor-plugin-table',
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
await mountEditor(page, {
|
|
135
|
-
appearance: fullpage.appearance,
|
|
136
|
-
defaultValue: JSON.stringify(defaultTableResizedTable),
|
|
137
|
-
allowTables: {
|
|
138
|
-
advanced: true,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
await clickFirstCell(page);
|
|
143
|
-
await toggleBreakout(page, 3);
|
|
144
|
-
|
|
145
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
146
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
BrowserTestCase(
|
|
151
|
-
'Scales down column sizes when bodied extension parent layout changes',
|
|
152
|
-
{ skip: ['firefox', 'safari'] },
|
|
153
|
-
async (client: any, testName: string) => {
|
|
154
|
-
const page = await goToEditorTestingWDExample(
|
|
155
|
-
client,
|
|
156
|
-
'editor-plugin-table',
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
await mountEditor(page, {
|
|
160
|
-
appearance: fullpage.appearance,
|
|
161
|
-
defaultValue: JSON.stringify(nestedTables),
|
|
162
|
-
allowTables: {
|
|
163
|
-
advanced: true,
|
|
164
|
-
},
|
|
165
|
-
allowExtension: {
|
|
166
|
-
allowBreakout: true,
|
|
167
|
-
},
|
|
168
|
-
allowLayouts: {
|
|
169
|
-
allowBreakout: true,
|
|
170
|
-
},
|
|
171
|
-
allowBreakout: true,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
await page.waitForSelector('.extension-container p');
|
|
175
|
-
await page.click('.extension-container p');
|
|
176
|
-
await changeSelectedNodeLayout(page, 'Back to center');
|
|
177
|
-
await animationFrame(page);
|
|
178
|
-
|
|
179
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
180
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
181
|
-
},
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
BrowserTestCase(
|
|
185
|
-
'Scales down column sizes when parent layout changes breakout',
|
|
186
|
-
{ skip: ['firefox', 'safari'] },
|
|
187
|
-
async (client: any, testName: string) => {
|
|
188
|
-
const page = await goToEditorTestingWDExample(
|
|
189
|
-
client,
|
|
190
|
-
'editor-plugin-table',
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
await mountEditor(page, {
|
|
194
|
-
appearance: fullpage.appearance,
|
|
195
|
-
defaultValue: JSON.stringify(nestedTables),
|
|
196
|
-
allowTables: {
|
|
197
|
-
advanced: true,
|
|
198
|
-
},
|
|
199
|
-
allowExtension: {
|
|
200
|
-
allowBreakout: true,
|
|
201
|
-
},
|
|
202
|
-
allowLayouts: {
|
|
203
|
-
allowBreakout: true,
|
|
204
|
-
},
|
|
205
|
-
allowBreakout: true,
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
await page.waitForSelector('div[data-layout-section]');
|
|
209
|
-
// Clicking at the paragraph inside of the left layout column
|
|
210
|
-
await page.click(
|
|
211
|
-
'div[data-layout-section] [data-layout-column="true"]:nth-child(2) [data-layout-content="true"] > p',
|
|
212
|
-
);
|
|
213
|
-
await toggleBreakout(page, 2);
|
|
214
|
-
await animationFrame(page);
|
|
215
|
-
|
|
216
|
-
const doc = await page.$eval(editable, getDocFromElement);
|
|
217
|
-
expect(doc).toMatchCustomDocSnapshot(testName);
|
|
218
|
-
},
|
|
219
|
-
);
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
2
|
-
import {
|
|
3
|
-
fullpage,
|
|
4
|
-
hoverResizeHandler,
|
|
5
|
-
quickInsert,
|
|
6
|
-
} from '@atlaskit/editor-test-helpers/integration/helpers';
|
|
7
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
8
|
-
import {
|
|
9
|
-
clickFirstCell,
|
|
10
|
-
getSelectorForTableCell,
|
|
11
|
-
} from '@atlaskit/editor-test-helpers/page-objects/table';
|
|
12
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
13
|
-
import {
|
|
14
|
-
goToEditorTestingWDExample,
|
|
15
|
-
mountEditor,
|
|
16
|
-
} from '@atlaskit/editor-test-helpers/testing-example-page';
|
|
17
|
-
import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
|
|
18
|
-
|
|
19
|
-
interface BBoxWithId {
|
|
20
|
-
left: number;
|
|
21
|
-
top: number;
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
id: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function calcOffset(
|
|
28
|
-
element: 'start' | 'target',
|
|
29
|
-
side: 'left' | 'top',
|
|
30
|
-
rect: BBoxWithId,
|
|
31
|
-
): number {
|
|
32
|
-
if (element === 'target' && side === 'left') {
|
|
33
|
-
return -(rect.width / 2);
|
|
34
|
-
} else if (element === 'start' && side === 'left') {
|
|
35
|
-
return +(rect.width * 0.8);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/*
|
|
42
|
-
* This is a regression test.
|
|
43
|
-
*
|
|
44
|
-
* The goal of this test is to make sure
|
|
45
|
-
* we can resize the table after a CellSelectio, and here is the why:
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* Given this cell A1
|
|
49
|
-
*
|
|
50
|
-
* ```
|
|
51
|
-
* ▁▁▁▁▁▁▁▁▁▁▁▁▁
|
|
52
|
-
* | ▒▒|
|
|
53
|
-
* | A1 ▒▒|
|
|
54
|
-
* | ▒▒|
|
|
55
|
-
* ▔▔▔▔▔▔▔▔▔▔▔▔▔
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* This element is a div, and every time the user hovers it, we should display a resize line.
|
|
59
|
-
* However, keeping a div for each cell in a table increases the HTML a lot,
|
|
60
|
-
* resulting in performance degradation to any DOM diff action.
|
|
61
|
-
* To avoid that, we decided to add the div on demand.
|
|
62
|
-
* Then, when the user comes close to that gap, we added a DIV.
|
|
63
|
-
* Next, we needed to check if the handle was already there using the resizeHandleColumnIndex from the PluginState.
|
|
64
|
-
* However, if that state was not clean properly, we could end up not adding the DIV element,
|
|
65
|
-
* then the user could not resize the column until they hover another one.
|
|
66
|
-
*
|
|
67
|
-
* We solved this problem search for the decorations too: if the DIV is not there, we will add it.
|
|
68
|
-
*/
|
|
69
|
-
BrowserTestCase(
|
|
70
|
-
'Should display the resizer handler after a cellselection',
|
|
71
|
-
// We are skipping other browsers because this test relies on drag and drop,
|
|
72
|
-
// and this API isn't stable in other browsers
|
|
73
|
-
{ skip: ['firefox', 'safari'] },
|
|
74
|
-
async (client: any, testName: string) => {
|
|
75
|
-
const page = await goToEditorTestingWDExample(
|
|
76
|
-
client,
|
|
77
|
-
'editor-plugin-table',
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
await mountEditor(page, {
|
|
81
|
-
appearance: fullpage.appearance,
|
|
82
|
-
allowTables: {
|
|
83
|
-
advanced: true,
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
await quickInsert(page, 'Table');
|
|
87
|
-
|
|
88
|
-
await clickFirstCell(page);
|
|
89
|
-
|
|
90
|
-
const firstCell = getSelectorForTableCell({
|
|
91
|
-
row: 2,
|
|
92
|
-
cell: 1,
|
|
93
|
-
});
|
|
94
|
-
const lastCell = getSelectorForTableCell({ row: 2, cell: 2 });
|
|
95
|
-
await hoverResizeHandler(page, 2, 1);
|
|
96
|
-
|
|
97
|
-
await page.simulateUserSelection(firstCell, lastCell, calcOffset);
|
|
98
|
-
|
|
99
|
-
// if it is not possible to resize this method will fail
|
|
100
|
-
await hoverResizeHandler(page, 2, 1);
|
|
101
|
-
|
|
102
|
-
expect(true).toBe(true);
|
|
103
|
-
},
|
|
104
|
-
);
|