@atlaskit/editor-plugin-table 5.3.25 → 5.3.27

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/table/commands/hover.js +9 -3
  3. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  4. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  5. package/dist/cjs/plugins/table/types.js +3 -0
  6. package/dist/cjs/plugins/table/ui/DragHandle/index.js +16 -4
  7. package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
  8. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
  9. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
  10. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  11. package/dist/cjs/plugins/table/ui/consts.js +2 -1
  12. package/dist/cjs/plugins/table/ui/icons/DragHandleDisabledIcon.js +45 -0
  13. package/dist/cjs/plugins/table/ui/icons/index.js +7 -0
  14. package/dist/cjs/plugins/table/ui/ui-styles.js +12 -9
  15. package/dist/cjs/plugins/table/utils/decoration.js +7 -1
  16. package/dist/es2019/plugins/table/commands/hover.js +13 -4
  17. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  18. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  19. package/dist/es2019/plugins/table/types.js +3 -0
  20. package/dist/es2019/plugins/table/ui/DragHandle/index.js +19 -6
  21. package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +27 -1
  22. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
  23. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
  24. package/dist/es2019/plugins/table/ui/common-styles.js +30 -38
  25. package/dist/es2019/plugins/table/ui/consts.js +1 -0
  26. package/dist/es2019/plugins/table/ui/icons/DragHandleDisabledIcon.js +37 -0
  27. package/dist/es2019/plugins/table/ui/icons/index.js +1 -0
  28. package/dist/es2019/plugins/table/ui/ui-styles.js +13 -1
  29. package/dist/es2019/plugins/table/utils/decoration.js +7 -1
  30. package/dist/esm/plugins/table/commands/hover.js +10 -4
  31. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
  32. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
  33. package/dist/esm/plugins/table/types.js +3 -0
  34. package/dist/esm/plugins/table/ui/DragHandle/index.js +18 -6
  35. package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
  36. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
  37. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
  38. package/dist/esm/plugins/table/ui/common-styles.js +2 -2
  39. package/dist/esm/plugins/table/ui/consts.js +1 -0
  40. package/dist/esm/plugins/table/ui/icons/DragHandleDisabledIcon.js +38 -0
  41. package/dist/esm/plugins/table/ui/icons/index.js +1 -0
  42. package/dist/esm/plugins/table/ui/ui-styles.js +12 -9
  43. package/dist/esm/plugins/table/utils/decoration.js +7 -1
  44. package/dist/types/plugins/table/types.d.ts +3 -0
  45. package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -1
  46. package/dist/types/plugins/table/ui/consts.d.ts +1 -0
  47. package/dist/types/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
  48. package/dist/types/plugins/table/ui/icons/index.d.ts +1 -0
  49. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
  50. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  51. package/dist/types/plugins/table/utils/selection.d.ts +2 -2
  52. package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
  53. package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -1
  54. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
  55. package/dist/types-ts4.5/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
  56. package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +1 -0
  57. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
  58. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +1 -1
  59. package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +2 -2
  60. package/package.json +2 -2
  61. package/src/plugins/table/commands/hover.ts +12 -1
  62. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +31 -7
  63. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
  64. package/src/plugins/table/types.ts +4 -0
  65. package/src/plugins/table/ui/DragHandle/index.tsx +36 -5
  66. package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +33 -1
  67. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -0
  68. package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
  69. package/src/plugins/table/ui/common-styles.ts +33 -40
  70. package/src/plugins/table/ui/consts.ts +6 -0
  71. package/src/plugins/table/ui/icons/DragHandleDisabledIcon.tsx +53 -0
  72. package/src/plugins/table/ui/icons/index.ts +1 -0
  73. package/src/plugins/table/ui/ui-styles.ts +13 -0
  74. package/src/plugins/table/utils/decoration.ts +14 -0
  75. package/src/plugins/table/utils/selection.ts +6 -2
  76. package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +0 -612
  77. package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +0 -820
  78. package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -120
  79. package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -120
  80. package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -229
  81. package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -239
  82. package/src/__tests__/integration/__snapshots__/resize.ts.snap +0 -2685
  83. package/src/__tests__/integration/__snapshots__/scale.ts.snap +0 -1085
  84. package/src/__tests__/integration/arrow-down-into-table.ts +0 -50
  85. package/src/__tests__/integration/auto-size.ts +0 -92
  86. package/src/__tests__/integration/cell-selection.ts +0 -105
  87. package/src/__tests__/integration/delete-columns.ts +0 -99
  88. package/src/__tests__/integration/delete-last-column-in-full-width.ts +0 -73
  89. package/src/__tests__/integration/delete-last-column-with-empty-action.ts +0 -60
  90. package/src/__tests__/integration/delete-last-row-with-empty-action.ts +0 -99
  91. package/src/__tests__/integration/insert-row-inside-layout.ts +0 -52
  92. package/src/__tests__/integration/resize.ts +0 -333
  93. package/src/__tests__/integration/scale.ts +0 -70
@@ -1,50 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- expectToMatchSelection,
4
- fullpage,
5
- setProseMirrorTextSelection,
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
- goToEditorTestingWDExample,
10
- mountEditor,
11
- } from '@atlaskit/editor-test-helpers/testing-example-page';
12
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
13
-
14
- import { documentWithParagraphAndTable } from './__fixtures__/paragraph-and-table-adf';
15
-
16
- const testArrowDown =
17
- (isNumberedColumnEnabled: boolean) => async (client: any) => {
18
- const page = await goToEditorTestingWDExample(
19
- client,
20
- 'editor-plugin-table',
21
- );
22
- await mountEditor(page, {
23
- appearance: fullpage.appearance,
24
- allowTables: {},
25
- defaultValue: documentWithParagraphAndTable(isNumberedColumnEnabled),
26
- });
27
-
28
- await setProseMirrorTextSelection(page, { anchor: 5 });
29
- await page.keys('ArrowDown');
30
- await expectToMatchSelection(page, { type: 'text', anchor: 10, head: 10 });
31
- };
32
-
33
- // This keyboard navigation is actually browser functionality
34
- // But there was a div on our end that caused a bug where the
35
- // cursor would go behind the table when pressing arrow down
36
- // https://product-fabric.atlassian.net/browse/ED-14046
37
- //
38
- // Skipping in firefox as there is a known bug
39
- // Needs to be fixed in https://product-fabric.atlassian.net/servicedesk/customer/portal/99/DTR-155?created=true
40
- BrowserTestCase(
41
- 'arrow-down-into-table.ts: pressing arrow down above table should move cursor into first row',
42
- { skip: ['firefox'] },
43
- testArrowDown(false),
44
- );
45
-
46
- BrowserTestCase(
47
- 'arrow-down-into-table.ts: pressing arrow down above table should move cursor into first row for a numbered table',
48
- { skip: ['firefox'] },
49
- testArrowDown(true),
50
- );
@@ -1,92 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- editable,
4
- fullpage,
5
- getDocFromElement,
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 sleep from '@atlaskit/editor-test-helpers/sleep';
9
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
10
- import {
11
- goToEditorTestingWDExample,
12
- mountEditor,
13
- } from '@atlaskit/editor-test-helpers/testing-example-page';
14
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
15
-
16
- import {
17
- autoSizeToDefaultLayout,
18
- autoSizeToFullWidthLayout,
19
- autoSizeToWideLayout,
20
- } from './__fixtures__/auto-size-documents';
21
-
22
- async function loadAndRetrieveDocument(
23
- page: any,
24
- document: object,
25
- expectedLayout = 'default',
26
- ) {
27
- await mountEditor(page, {
28
- appearance: fullpage.appearance,
29
- defaultValue: JSON.stringify(document),
30
- allowPanel: true,
31
- allowTables: {
32
- advanced: true,
33
- },
34
- });
35
-
36
- await page.waitForSelector(`table[data-layout="${expectedLayout}"]`);
37
- await sleep(500);
38
-
39
- const doc = await page.$eval(editable, getDocFromElement);
40
- return doc;
41
- }
42
-
43
- BrowserTestCase(
44
- 'Doesnt scale past default',
45
- {
46
- skip: ['*'],
47
- },
48
- async (client: any, testName: string) => {
49
- const page = await goToEditorTestingWDExample(
50
- client,
51
- 'editor-plugin-table',
52
- );
53
- const doc = await loadAndRetrieveDocument(page, autoSizeToDefaultLayout);
54
- expect(doc).toMatchCustomDocSnapshot(testName);
55
- },
56
- );
57
-
58
- BrowserTestCase(
59
- 'Scales to wide',
60
- {
61
- skip: ['*'],
62
- },
63
- async (client: any, testName: string) => {
64
- const page = await goToEditorTestingWDExample(
65
- client,
66
- 'editor-plugin-table',
67
- );
68
- const doc = await loadAndRetrieveDocument(
69
- page,
70
- autoSizeToWideLayout,
71
- 'wide',
72
- );
73
- expect(doc).toMatchCustomDocSnapshot(testName);
74
- },
75
- );
76
-
77
- BrowserTestCase(
78
- 'Scales to full-width',
79
- { skip: ['safari', 'firefox'] },
80
- async (client: any, testName: string) => {
81
- const page = await goToEditorTestingWDExample(
82
- client,
83
- 'editor-plugin-table',
84
- );
85
- const doc = await loadAndRetrieveDocument(
86
- page,
87
- autoSizeToFullWidthLayout,
88
- 'full-width',
89
- );
90
- expect(doc).toMatchCustomDocSnapshot(testName);
91
- },
92
- );
@@ -1,105 +0,0 @@
1
- import isEqual from 'lodash/isEqual';
2
-
3
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
4
- import { fullpage } from '@atlaskit/editor-test-helpers/integration/helpers';
5
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
6
- import {
7
- multiCellTableSelectionBottomRightToFirstCell,
8
- multiCellTableSelectionBottomRightToMiddleTopCell,
9
- multiCellTableSelectionTopLeftToBottomRight,
10
- } from '@atlaskit/editor-test-helpers/page-objects/table';
11
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
- import {
13
- goToEditorTestingWDExample,
14
- mountEditor,
15
- } from '@atlaskit/editor-test-helpers/testing-example-page';
16
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
17
-
18
- import tableWithTextAndEmptyRow from './__fixtures__/table-with-text-and-empty-row';
19
-
20
- BrowserTestCase(
21
- 'multi cell table selection should correctly highlight entire table selection',
22
- { skip: ['chrome'] }, // https://product-fabric.atlassian.net/browse/DTR-330
23
- async (client: any) => {
24
- const page = await goToEditorTestingWDExample(
25
- client,
26
- 'editor-plugin-table',
27
- );
28
-
29
- await mountEditor(page, {
30
- appearance: fullpage.appearance,
31
- allowTables: {
32
- advanced: true,
33
- },
34
- defaultValue: tableWithTextAndEmptyRow,
35
- });
36
-
37
- await multiCellTableSelectionTopLeftToBottomRight(page);
38
-
39
- const selection = await page.execute(() => {
40
- const view = (window as any).__editorView;
41
- return view.state.selection;
42
- });
43
-
44
- const isMatch = isEqual(selection, { type: 'cell', anchor: 2, head: 97 });
45
- expect(isMatch).toBe(true);
46
- },
47
- );
48
-
49
- BrowserTestCase(
50
- 'multi cell table selection should correctly highlight table selection from the second row',
51
- { skip: ['chrome'] }, // https://product-fabric.atlassian.net/browse/DTR-330
52
- async (client: any) => {
53
- const page = await goToEditorTestingWDExample(
54
- client,
55
- 'editor-plugin-table',
56
- );
57
-
58
- await mountEditor(page, {
59
- appearance: fullpage.appearance,
60
- allowTables: {
61
- advanced: true,
62
- },
63
- defaultValue: tableWithTextAndEmptyRow,
64
- });
65
-
66
- await multiCellTableSelectionBottomRightToFirstCell(page);
67
-
68
- const selection = await page.execute(() => {
69
- const view = (window as any).__editorView;
70
- return view.state.selection;
71
- });
72
-
73
- const isMatch = isEqual(selection, { anchor: 97, head: 31, type: 'cell' });
74
- expect(isMatch).toBe(true);
75
- },
76
- );
77
-
78
- BrowserTestCase(
79
- 'multi cell table selection should correctly highlight table selection from the second column',
80
- { skip: ['chrome'] }, // https://product-fabric.atlassian.net/browse/DTR-330
81
- async (client: any) => {
82
- const page = await goToEditorTestingWDExample(
83
- client,
84
- 'editor-plugin-table',
85
- );
86
-
87
- await mountEditor(page, {
88
- appearance: fullpage.appearance,
89
- allowTables: {
90
- advanced: true,
91
- },
92
- defaultValue: tableWithTextAndEmptyRow,
93
- });
94
-
95
- await multiCellTableSelectionBottomRightToMiddleTopCell(page);
96
-
97
- const selection = await page.execute(() => {
98
- const view = (window as any).__editorView;
99
- return view.state.selection;
100
- });
101
-
102
- const isMatch = isEqual(selection, { anchor: 97, head: 11, type: 'cell' });
103
- expect(isMatch).toBe(true);
104
- },
105
- );
@@ -1,99 +0,0 @@
1
- import { createIntl } from 'react-intl-next';
2
-
3
- import { tableMessages as messages } from '@atlaskit/editor-common/messages';
4
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
5
- import {
6
- editable,
7
- fullpage,
8
- getDocFromElement,
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 {
12
- goToEditorTestingWDExample,
13
- mountEditor,
14
- } from '@atlaskit/editor-test-helpers/testing-example-page';
15
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
16
-
17
- import { TableCssClassName as ClassName } from '../../plugins/table/types';
18
-
19
- import { documentWithMergedCells } from './__fixtures__/merged-rows-and-cols-document';
20
-
21
- BrowserTestCase(
22
- 'Should delete merged columns from contextual menu and append missing cells to the table',
23
- { skip: ['firefox', 'safari'] },
24
- async (client: any, testName: string) => {
25
- const page = await goToEditorTestingWDExample(
26
- client,
27
- 'editor-plugin-table',
28
- );
29
- const intl = createIntl({
30
- locale: 'en',
31
- });
32
-
33
- await mountEditor(page, {
34
- appearance: fullpage.appearance,
35
- defaultValue: JSON.stringify(documentWithMergedCells),
36
- allowTables: {
37
- advanced: true,
38
- },
39
- });
40
-
41
- const controlSelector = `tbody tr:first-child th:nth-child(2)`;
42
- await page.waitForSelector(controlSelector);
43
- await page.click(controlSelector);
44
-
45
- const contextMenuTriggerSelector = `.${ClassName.CONTEXTUAL_MENU_BUTTON}`;
46
- await page.waitForSelector(contextMenuTriggerSelector);
47
- await page.click(contextMenuTriggerSelector);
48
-
49
- const message = await intl.formatMessage(messages.removeColumns, {
50
- 0: 1,
51
- });
52
- const contextMenuItemSelector = `span=${message}`;
53
- await page.waitForSelector(contextMenuItemSelector);
54
- await page.click(contextMenuItemSelector);
55
-
56
- const doc = await page.$eval(editable, getDocFromElement);
57
- expect(doc).toMatchCustomDocSnapshot(testName);
58
- },
59
- );
60
-
61
- BrowserTestCase(
62
- 'Should delete merged columns from contextual menu and decrement colspan of the spanning cell',
63
- { skip: ['firefox', 'safari'] },
64
- async (client: any, testName: string) => {
65
- const page = await goToEditorTestingWDExample(
66
- client,
67
- 'editor-plugin-table',
68
- );
69
- const intl = createIntl({
70
- locale: 'en',
71
- });
72
-
73
- await mountEditor(page, {
74
- appearance: fullpage.appearance,
75
- defaultValue: JSON.stringify(documentWithMergedCells),
76
- allowTables: {
77
- advanced: true,
78
- },
79
- });
80
-
81
- const controlSelector = `tbody tr:first-child th:nth-child(3)`;
82
- await page.waitForSelector(controlSelector);
83
- await page.click(controlSelector);
84
-
85
- const contextMenuTriggerSelector = `.${ClassName.CONTEXTUAL_MENU_BUTTON}`;
86
- await page.waitForSelector(contextMenuTriggerSelector);
87
- await page.click(contextMenuTriggerSelector);
88
-
89
- const message = await intl.formatMessage(messages.removeColumns, {
90
- 0: 1,
91
- });
92
- const contextMenuItemSelector = `span=${message}`;
93
- await page.waitForSelector(contextMenuItemSelector);
94
- await page.click(contextMenuItemSelector);
95
-
96
- const doc = await page.$eval(editable, getDocFromElement);
97
- expect(doc).toMatchCustomDocSnapshot(testName);
98
- },
99
- );
@@ -1,73 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- editable,
4
- fullpage,
5
- getDocFromElement,
6
- quickInsert,
7
- } from '@atlaskit/editor-test-helpers/integration/helpers';
8
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
9
- import {
10
- goToEditorTestingWDExample,
11
- mountEditor,
12
- } from '@atlaskit/editor-test-helpers/testing-example-page';
13
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
14
-
15
- import { TableCssClassName as ClassName } from '../../plugins/table/types';
16
-
17
- // ED-6231
18
- BrowserTestCase(
19
- 'Delete last table column in full-width mode',
20
- // Only Chrome has logging support in BrowserStack now
21
- { skip: [] },
22
- async (client: any, testName: string) => {
23
- const page = await goToEditorTestingWDExample(
24
- client,
25
- 'editor-plugin-table',
26
- );
27
- await mountEditor(
28
- page,
29
- {
30
- appearance: fullpage.appearance,
31
- allowTables: {
32
- advanced: true,
33
- },
34
- },
35
- { i18n: { locale: 'en' } },
36
- );
37
-
38
- await page.click(editable);
39
-
40
- // Insert table
41
- await quickInsert(page, 'Table');
42
-
43
- // Change layout to full-width
44
- await page.waitForSelector(`.${ClassName.LAYOUT_BUTTON}`);
45
- await page.click(`.${ClassName.LAYOUT_BUTTON}`);
46
- await page.click(`.${ClassName.LAYOUT_BUTTON}`);
47
-
48
- await page.click(editable);
49
-
50
- // Select button wrapper from last column
51
- const controlSelector = `.${ClassName.COLUMN_CONTROLS_DECORATIONS}[data-start-index="2"]`;
52
- await page.waitForSelector(controlSelector);
53
- await page.hover(controlSelector);
54
- await page.click(controlSelector);
55
-
56
- // Click on delete row button
57
- const deleteButtonSelector = `.${ClassName.CONTROLS_DELETE_BUTTON_WRAP} .${ClassName.CONTROLS_DELETE_BUTTON}`;
58
- await page.waitForVisible(deleteButtonSelector);
59
- await page.click(deleteButtonSelector);
60
-
61
- // TODO: Figure out why this is causing a warning and causing the following check to fail in chrome.
62
- // await page.checkConsoleErrors({
63
- // ignoreErrors: [
64
- // /is potentially unsafe when doing server-side rendering\. Try changing it to/,
65
- // ],
66
- // });
67
-
68
- const doc = await page.$eval(editable, getDocFromElement);
69
- expect(doc).toMatchCustomDocSnapshot(testName);
70
- },
71
- );
72
-
73
- it.todo('ED-15748: Test is not working properly with checkConsoleErrors');
@@ -1,60 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- editable,
4
- fullpage,
5
- getDocFromElement,
6
- quickInsert,
7
- } from '@atlaskit/editor-test-helpers/integration/helpers';
8
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
9
- import {
10
- goToEditorTestingWDExample,
11
- mountEditor,
12
- } from '@atlaskit/editor-test-helpers/testing-example-page';
13
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
14
-
15
- import { TableCssClassName as ClassName } from '../../plugins/table/types';
16
-
17
- BrowserTestCase(
18
- 'delete-last-column-with-empty-action.ts: Delete last table column with empty action',
19
- {},
20
- async (client: any, testName: string) => {
21
- const LAST_HEADER_FROM_FIRST_ROW =
22
- 'table > tbody > tr:first-child > th:last-child';
23
-
24
- const page = await goToEditorTestingWDExample(
25
- client,
26
- 'editor-plugin-table',
27
- );
28
- await mountEditor(page, {
29
- appearance: fullpage.appearance,
30
- allowTables: {
31
- advanced: true,
32
- },
33
- });
34
-
35
- await page.click(editable);
36
-
37
- // Insert table and click on last cell of first row
38
- await quickInsert(page, 'Table');
39
- await page.waitForSelector(LAST_HEADER_FROM_FIRST_ROW);
40
- await page.click(LAST_HEADER_FROM_FIRST_ROW);
41
-
42
- // Add empty action on first cell from last row
43
- await quickInsert(page, 'Action item');
44
-
45
- // Select button wrapper from last column
46
- const controlSelector = `.${ClassName.COLUMN_CONTROLS_DECORATIONS}[data-start-index="2"]`;
47
- await page.waitForSelector(controlSelector);
48
- // We need to move the mouse to the column control first
49
- await page.hover(controlSelector, { x: 10, y: 1 });
50
- await page.click(controlSelector);
51
-
52
- // Click on delete row button
53
- const deleteButtonSelector = `.${ClassName.CONTROLS_DELETE_BUTTON_WRAP} .${ClassName.CONTROLS_DELETE_BUTTON}`;
54
- await page.waitForVisible(deleteButtonSelector);
55
- await page.click(deleteButtonSelector);
56
-
57
- const doc = await page.$eval(editable, getDocFromElement);
58
- expect(doc).toMatchCustomDocSnapshot(testName);
59
- },
60
- );
@@ -1,99 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- editable,
4
- fullpage,
5
- getDocFromElement,
6
- quickInsert,
7
- } from '@atlaskit/editor-test-helpers/integration/helpers';
8
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
9
- import {
10
- goToEditorTestingWDExample,
11
- mountEditor,
12
- } from '@atlaskit/editor-test-helpers/testing-example-page';
13
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
14
-
15
- import { TableCssClassName as ClassName } from '../../plugins/table/types';
16
-
17
- BrowserTestCase(
18
- 'delete-last-row.ts: Delete last table row with empty action',
19
- { skip: ['chrome'] },
20
- async (client: any, testName: string) => {
21
- const FIRST_CELL_FROM_LAST_ROW =
22
- 'table > tbody > tr:last-child > td:first-child';
23
- const page = await goToEditorTestingWDExample(
24
- client,
25
- 'editor-plugin-table',
26
- );
27
- await mountEditor(page, {
28
- appearance: fullpage.appearance,
29
- allowTables: {
30
- advanced: true,
31
- },
32
- });
33
-
34
- await page.click(editable);
35
-
36
- // Insert table and click on first cell
37
- await quickInsert(page, 'Table');
38
- await page.waitForSelector(FIRST_CELL_FROM_LAST_ROW);
39
- await page.click(FIRST_CELL_FROM_LAST_ROW);
40
-
41
- // Add empty action on first cell from last row
42
- await quickInsert(page, 'Action item');
43
-
44
- // Select button wrapper from last row
45
- const controlSelector = `.${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:last-child .${ClassName.CONTROLS_BUTTON}`;
46
- await page.waitForSelector(controlSelector);
47
- await page.click(controlSelector);
48
-
49
- // Click on delete row button
50
- const deleteButtonSelector = `.${ClassName.CONTROLS_DELETE_BUTTON_WRAP} .${ClassName.CONTROLS_DELETE_BUTTON}`;
51
- await page.waitForVisible(deleteButtonSelector);
52
- await page.click(deleteButtonSelector);
53
-
54
- const doc = await page.$eval(editable, getDocFromElement);
55
- expect(doc).toMatchCustomDocSnapshot(testName);
56
- },
57
- );
58
-
59
- BrowserTestCase(
60
- 'delete-last-row.ts: Delete last table row with empty action, chrome',
61
- { skip: ['firefox', 'safari'] },
62
- async (client: any, testName: string) => {
63
- const FIRST_CELL_FROM_LAST_ROW =
64
- 'table > tbody > tr:last-child > td:first-child';
65
- const page = await goToEditorTestingWDExample(
66
- client,
67
- 'editor-plugin-table',
68
- );
69
- await mountEditor(page, {
70
- appearance: fullpage.appearance,
71
- allowTables: {
72
- advanced: true,
73
- },
74
- });
75
-
76
- await page.click(editable);
77
-
78
- // Insert table and click on first cell
79
- await quickInsert(page, 'Table');
80
- await page.waitForSelector(FIRST_CELL_FROM_LAST_ROW);
81
- await page.click(FIRST_CELL_FROM_LAST_ROW);
82
-
83
- // Add empty action on first cell from last row
84
- await quickInsert(page, 'Action item');
85
-
86
- // Select button wrapper from last row
87
- const controlSelector = `.${ClassName.ROW_CONTROLS_WRAPPER} .${ClassName.ROW_CONTROLS_BUTTON_WRAP}:last-child .${ClassName.CONTROLS_BUTTON}`;
88
- await page.waitForSelector(controlSelector);
89
- await page.click(controlSelector);
90
-
91
- // Click on delete row button
92
- const deleteButtonSelector = `.${ClassName.CONTROLS_DELETE_BUTTON_WRAP} .${ClassName.CONTROLS_DELETE_BUTTON}`;
93
- await page.waitForVisible(deleteButtonSelector);
94
- await page.click(deleteButtonSelector);
95
-
96
- const doc = await page.$eval(editable, getDocFromElement);
97
- expect(doc).toMatchCustomDocSnapshot(testName);
98
- },
99
- );
@@ -1,52 +0,0 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
2
- import {
3
- animationFrame,
4
- editable,
5
- fullpage,
6
- getDocFromElement,
7
- } from '@atlaskit/editor-test-helpers/integration/helpers';
8
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
9
- import {
10
- clickFirstCell,
11
- insertRow,
12
- } from '@atlaskit/editor-test-helpers/page-objects/table';
13
- // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
14
- import {
15
- goToEditorTestingWDExample,
16
- mountEditor,
17
- } from '@atlaskit/editor-test-helpers/testing-example-page';
18
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
19
-
20
- import { table as tableInsideLayout } from './__fixtures__/table-inside-layout';
21
-
22
- BrowserTestCase(
23
- 'Should scale remaining columns when adding a new column preventing from going to overflow',
24
- { skip: [] },
25
- async (client: any, testName: string) => {
26
- const page = await goToEditorTestingWDExample(
27
- client,
28
- 'editor-plugin-table',
29
- );
30
-
31
- await mountEditor(page, {
32
- appearance: fullpage.appearance,
33
- defaultValue: JSON.stringify(tableInsideLayout),
34
- allowTables: {
35
- advanced: true,
36
- },
37
- allowLayouts: {
38
- allowBreakout: true,
39
- },
40
- allowBreakout: true,
41
- });
42
-
43
- await clickFirstCell(page);
44
- await animationFrame(page);
45
- await animationFrame(page);
46
- await insertRow(page, 1);
47
- await page.type(editable, 'should be inside of the table');
48
-
49
- const doc = await page.$eval(editable, getDocFromElement);
50
- expect(doc).toMatchCustomDocSnapshot(testName);
51
- },
52
- );