@atlaskit/adf-schema 28.1.7 → 28.1.9

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 (63) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/schema/create-schema.js +2 -2
  3. package/dist/cjs/schema/marks/annotation.js +2 -2
  4. package/dist/cjs/schema/marks/data-consumer.js +2 -2
  5. package/dist/cjs/schema/marks/fragment.js +2 -2
  6. package/dist/cjs/schema/marks/link.js +2 -2
  7. package/dist/cjs/schema/nodes/block-card.js +2 -2
  8. package/dist/cjs/schema/nodes/expand.js +2 -2
  9. package/dist/cjs/schema/nodes/media-single.js +2 -2
  10. package/dist/cjs/schema/nodes/mention.js +2 -2
  11. package/dist/cjs/schema/nodes/ordered-list.js +2 -2
  12. package/dist/cjs/schema/nodes/panel.js +2 -2
  13. package/dist/cjs/schema/nodes/tableNodes.js +2 -2
  14. package/dist/cjs/steps/analytics.js +2 -2
  15. package/dist/cjs/steps/set-attrs.js +2 -2
  16. package/dist/cjs/steps/table/add-column.js +2 -2
  17. package/dist/cjs/steps/table/utils/cell-step.js +2 -2
  18. package/dist/cjs/steps/table/utils/side-effects/rows.js +2 -2
  19. package/dist/esm/schema/create-schema.js +2 -2
  20. package/dist/esm/schema/marks/annotation.js +2 -2
  21. package/dist/esm/schema/marks/data-consumer.js +2 -2
  22. package/dist/esm/schema/marks/fragment.js +2 -2
  23. package/dist/esm/schema/marks/link.js +2 -2
  24. package/dist/esm/schema/nodes/block-card.js +2 -2
  25. package/dist/esm/schema/nodes/expand.js +2 -2
  26. package/dist/esm/schema/nodes/media-single.js +2 -2
  27. package/dist/esm/schema/nodes/mention.js +2 -2
  28. package/dist/esm/schema/nodes/ordered-list.js +2 -2
  29. package/dist/esm/schema/nodes/panel.js +2 -2
  30. package/dist/esm/schema/nodes/tableNodes.js +2 -2
  31. package/dist/esm/steps/analytics.js +2 -2
  32. package/dist/esm/steps/set-attrs.js +2 -2
  33. package/dist/esm/steps/table/add-column.js +2 -2
  34. package/dist/esm/steps/table/utils/cell-step.js +2 -2
  35. package/dist/esm/steps/table/utils/side-effects/rows.js +2 -2
  36. package/package.json +2 -2
  37. package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +1 -5
  38. package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +1 -1
  39. package/src/__tests__/unit/schema/nodes/date.ts +1 -1
  40. package/src/__tests__/unit/schema/nodes/expand.ts +1 -1
  41. package/src/__tests__/unit/schema/nodes/inline-extension.ts +1 -1
  42. package/src/__tests__/unit/schema/nodes/list-item.ts +1 -1
  43. package/src/__tests__/unit/schema/nodes/media-group.ts +1 -1
  44. package/src/__tests__/unit/schema/nodes/media-single.ts +1 -1
  45. package/src/__tests__/unit/schema/nodes/media.ts +1 -5
  46. package/src/__tests__/unit/schema/nodes/nestedExpand.ts +1 -1
  47. package/src/__tests__/unit/schema/nodes/ordered-list.ts +1 -1
  48. package/src/__tests__/unit/schema/nodes/placeholder.ts +1 -1
  49. package/src/__tests__/unit/schema/nodes/status.ts +1 -1
  50. package/src/__tests__/unit/schema/nodes/unknown-block.ts +1 -1
  51. package/src/__tests__/unit/schema/nodes/unsupported-block.ts +1 -1
  52. package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +1 -1
  53. package/src/schema/nodes/media-single.ts +2 -2
  54. package/src/schema/nodes/media.ts +5 -1
  55. package/src/schema/nodes/tableNodes.ts +3 -5
  56. package/src/steps/__tests__/unit/override-document-step.ts +6 -6
  57. package/src/steps/table/__tests__/_utils.ts +6 -7
  58. package/src/steps/table/__tests__/add-column-merge-columns.ts +27 -9
  59. package/src/steps/table/__tests__/add-column-merge-rows.ts +24 -8
  60. package/src/steps/table/__tests__/add-column.ts +46 -18
  61. package/src/steps/table/add-column.ts +4 -1
  62. package/src/steps/table/utils/cells-at-column.ts +4 -1
  63. package/src/utils/colors.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "28.1.7",
3
+ "version": "28.1.9",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,7 +27,7 @@
27
27
  "build:types": "NODE_ENV=production tsc --project ./build/tsconfig.json --emitDeclarationOnly --outDir ./dist/types --rootDir ./src && yarn build:jsontypes",
28
28
  "build:jsontypes": "mkdir -p dist/types/json-schema && cp src/json-schema/index.ts dist/types/json-schema/index.d.ts",
29
29
  "build:all": "yarn build:cjs && yarn build:esm && yarn build:es2019 && yarn build:types",
30
- "build": "yarn run build:all && yarn run generate:json-schema && yarn run build:json-schema",
30
+ "build": "yarn workspace @atlaskit/editor-prosemirror build && yarn run build:all && yarn run generate:json-schema && yarn run build:json-schema",
31
31
  "clean": "../../scripts/build-clean.sh"
32
32
  },
33
33
  "dependencies": {
@@ -1,8 +1,4 @@
1
- import {
2
- schema,
3
- toDOM,
4
- fromHTML,
5
- } from 'adf-test-helpers/src/adf-schema';
1
+ import { schema, toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema';
6
2
 
7
3
  const packageName = process.env._PACKAGE_NAME_ as string;
8
4
 
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { date } from '../../../..';
3
3
 
4
- import { schema } from 'adf-test-helpers/src/adf-schema'
4
+ import { schema } from 'adf-test-helpers/src/adf-schema';
5
5
 
6
6
  const packageName = process.env._PACKAGE_NAME_ as string;
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { expand } from '../../../..';
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
  const packageName = process.env._PACKAGE_NAME_ as string;
5
5
 
6
6
  describe(`${packageName}/schema expand node`, () => {
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { inlineExtension } from '../../../..';
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -2,7 +2,7 @@ import { toHTML, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
3
  import { doc, ol, li, p } from 'adf-test-helpers/src/adf-schema/schema-builder';
4
4
 
5
- import { schema } from 'adf-test-helpers/src/adf-schema'
5
+ import { schema } from 'adf-test-helpers/src/adf-schema';
6
6
  const packageName = process.env._PACKAGE_NAME_ as string;
7
7
 
8
8
  describe(`${packageName}/schema listItem node`, () => {
@@ -1,6 +1,6 @@
1
1
  import { fromHTML, toDOM } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -6,11 +6,7 @@ import {
6
6
  createMediaSpec,
7
7
  } from '../../../../schema/nodes/media';
8
8
  import { image as ImageNodeSpec } from '../../../../schema/nodes/image';
9
- import {
10
- fromHTML,
11
- toDOM,
12
- schema,
13
- } from 'adf-test-helpers/src/adf-schema';
9
+ import { fromHTML, toDOM, schema } from 'adf-test-helpers/src/adf-schema';
14
10
 
15
11
  // Note: We can't use dom.dataset in jest until it's upgraded to use latest version
16
12
  // of jsdom. In the meantime we can use this helper-method.
@@ -1,7 +1,7 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { nestedExpand } from '../../../..';
3
3
  import { Schema, Node } from '@atlaskit/editor-prosemirror/model';
4
- import { schema } from 'adf-test-helpers/src/adf-schema'
4
+ import { schema } from 'adf-test-helpers/src/adf-schema';
5
5
 
6
6
  const findNestedExpand = (doc: Node, schema: Schema) => {
7
7
  let expand: Node | null = null;
@@ -1,5 +1,5 @@
1
1
  import { toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
- import { schema } from 'adf-test-helpers/src/adf-schema'
2
+ import { schema } from 'adf-test-helpers/src/adf-schema';
3
3
  const packageName = process.env._PACKAGE_NAME_ as string;
4
4
 
5
5
  describe(`${packageName}/schema orderedList node`, () => {
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { placeholder } from '../../../..';
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { status } from '../../../..';
3
3
  import { StatusLocalIdRegex } from 'adf-test-helpers/src/constants';
4
- import { schema } from 'adf-test-helpers/src/adf-schema'
4
+ import { schema } from 'adf-test-helpers/src/adf-schema';
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
7
7
  describe(`${packageName}/schema status node`, () => {
@@ -1,7 +1,7 @@
1
1
  import { fromHTML, toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
  import { inlineNodes } from '../../../../schema/inline-nodes';
3
3
 
4
- import { schema } from 'adf-test-helpers/src/adf-schema'
4
+ import { schema } from 'adf-test-helpers/src/adf-schema';
5
5
 
6
6
  const packageName = process.env._PACKAGE_NAME_ as string;
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
2
2
 
3
- import { schema } from 'adf-test-helpers/src/adf-schema'
3
+ import { schema } from 'adf-test-helpers/src/adf-schema';
4
4
 
5
5
  const packageName = process.env._PACKAGE_NAME_ as string;
6
6
 
@@ -57,10 +57,10 @@ export type MediaSingleFullDefinition = MediaSingleBaseDefinition &
57
57
 
58
58
  export const defaultAttrs: {
59
59
  width: {
60
- default: null;
60
+ default: null;
61
61
  };
62
62
  layout: {
63
- default: string;
63
+ default: string;
64
64
  };
65
65
  } = {
66
66
  width: { default: null }, // null makes small images to have original size by default
@@ -201,7 +201,11 @@ export const media: NodeSpec = createMediaSpec(defaultAttrs);
201
201
  export const camelCaseToKebabCase = (str: string) =>
202
202
  str.replace(/([^A-Z]+)([A-Z])/g, (_, x, y) => `${x}-${y.toLowerCase()}`);
203
203
 
204
- export const copyPrivateAttributes: (from: Record<string, any>, to: Record<string, any>, map?: ((str: string) => string) | undefined) => void = (
204
+ export const copyPrivateAttributes: (
205
+ from: Record<string, any>,
206
+ to: Record<string, any>,
207
+ map?: ((str: string) => string) | undefined,
208
+ ) => void = (
205
209
  from: Record<string, any>,
206
210
  to: Record<string, any>,
207
211
  map?: (str: string) => string,
@@ -65,16 +65,14 @@ export const tableCellContentDomSelector = `${tablePrefixSelector}-cell-nodeview
65
65
  const DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
66
66
 
67
67
  export const getCellAttrs: (
68
- dom: HTMLElement, defaultValues?: CellAttributes
68
+ dom: HTMLElement,
69
+ defaultValues?: CellAttributes,
69
70
  ) => {
70
71
  colspan: number;
71
72
  rowspan: number;
72
73
  colwidth: number[] | null;
73
74
  background: string | null;
74
- } = (
75
- dom: HTMLElement,
76
- defaultValues: CellAttributes = {},
77
- ) => {
75
+ } = (dom: HTMLElement, defaultValues: CellAttributes = {}) => {
78
76
  const widthAttr = dom.getAttribute('data-colwidth');
79
77
  const width =
80
78
  widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
@@ -23,8 +23,8 @@ describe('Override Document Step', () => {
23
23
  }),
24
24
  );
25
25
 
26
- expect(tr.doc).toEqualDocument(nextDocument);
27
- expect(tr.docs[0]).toEqualDocument(currentDocument(defaultSchema));
26
+ expect(tr.doc).toEqual(nextDocument);
27
+ expect(tr.docs[0]).toEqual(currentDocument(defaultSchema));
28
28
  });
29
29
 
30
30
  describe('when the inverted step is applied', () => {
@@ -40,9 +40,9 @@ describe('Override Document Step', () => {
40
40
  tr.step(step);
41
41
  tr.step(stepInverted);
42
42
 
43
- expect(tr.doc).toEqualDocument(currentDocument(defaultSchema));
44
- expect(tr.docs[1]).toEqualDocument(nextDocument);
45
- expect(tr.docs[0]).toEqualDocument(currentDocument(defaultSchema));
43
+ expect(tr.doc).toEqual(currentDocument(defaultSchema));
44
+ expect(tr.docs[1]).toEqual(nextDocument);
45
+ expect(tr.docs[0]).toEqual(currentDocument(defaultSchema));
46
46
  });
47
47
  });
48
48
 
@@ -166,7 +166,7 @@ describe('Override Document Step', () => {
166
166
  currentDocument(defaultSchema),
167
167
  );
168
168
 
169
- expect(stepAppliedResult.doc).toEqualDocument(
169
+ expect(stepAppliedResult.doc).toMatchObject(
170
170
  deserializedStepAppliedResult.doc,
171
171
  );
172
172
  });
@@ -1,12 +1,11 @@
1
1
  import { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
2
- import { EditorState, Plugin, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import { history, undo } from '@atlaskit/editor-prosemirror/history';
4
2
  import {
5
- DocBuilder,
6
- p,
7
- Refs,
8
- td,
9
- } from 'adf-test-helpers/src/doc-builder';
3
+ EditorState,
4
+ Plugin,
5
+ Transaction,
6
+ } from '@atlaskit/editor-prosemirror/state';
7
+ import { history, undo } from '@atlaskit/editor-prosemirror/history';
8
+ import { DocBuilder, p, Refs, td } from 'adf-test-helpers/src/doc-builder';
10
9
  import { setSelectionTransform } from 'adf-test-helpers/src/set-selection-transform';
11
10
 
12
11
  import { defaultSchema } from '../../../schema/default-schema';
@@ -147,7 +147,9 @@ describe('AddColumnStep', () => {
147
147
  addColumnAtFactory('table', column)(editorState, refs),
148
148
  );
149
149
 
150
- expect(editorState.doc).toEqualDocument(expectedDoc);
150
+ expect(editorState.doc.toJSON()).toEqual(
151
+ expectedDoc(defaultSchema).toJSON(),
152
+ );
151
153
  },
152
154
  );
153
155
  });
@@ -165,7 +167,9 @@ describe('AddColumnStep', () => {
165
167
  removeColumnAtFactory('table', column)(editorState, refs),
166
168
  );
167
169
 
168
- expect(editorState.doc).toEqualDocument(expectedDoc);
170
+ expect(editorState.doc.toJSON()).toEqual(
171
+ expectedDoc(defaultSchema).toJSON(),
172
+ );
169
173
  },
170
174
  );
171
175
  });
@@ -195,7 +199,9 @@ describe('AddColumnStep', () => {
195
199
  transaction,
196
200
  editorState,
197
201
  );
198
- expect(editorState.doc).toEqualDocument(originalDoc);
202
+ expect(editorState.doc.toJSON()).toEqual(
203
+ originalDoc(defaultSchema).toJSON(),
204
+ );
199
205
  });
200
206
  });
201
207
 
@@ -285,7 +291,9 @@ describe('AddColumnStep', () => {
285
291
 
286
292
  editorState = editorState.apply(editorState.tr.step(addColumnStep!));
287
293
 
288
- expect(editorState.doc).toEqualDocument(expectedDoc);
294
+ expect(editorState.doc.toJSON()).toEqual(
295
+ expectedDoc(defaultSchema).toJSON(),
296
+ );
289
297
  },
290
298
  );
291
299
  });
@@ -359,7 +367,9 @@ describe('AddColumnStep', () => {
359
367
  historyTransactions,
360
368
  );
361
369
 
362
- expect(editorState.doc).toEqualDocument(expectDoc);
370
+ expect(editorState.doc.toJSON()).toEqual(
371
+ expectDoc(defaultSchema).toJSON(),
372
+ );
363
373
  });
364
374
  },
365
375
  );
@@ -380,7 +390,9 @@ describe('AddColumnStep', () => {
380
390
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
381
391
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
382
392
 
383
- expect(editorState.doc).toEqualDocument(expectedDoc);
393
+ expect(editorState.doc.toJSON()).toEqual(
394
+ expectedDoc(defaultSchema).toJSON(),
395
+ );
384
396
  },
385
397
  );
386
398
 
@@ -398,7 +410,9 @@ describe('AddColumnStep', () => {
398
410
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
399
411
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
400
412
 
401
- expect(editorState.doc).toEqualDocument(expectedDoc);
413
+ expect(editorState.doc.toJSON()).toEqual(
414
+ expectedDoc(defaultSchema).toJSON(),
415
+ );
402
416
  },
403
417
  );
404
418
 
@@ -413,7 +427,9 @@ describe('AddColumnStep', () => {
413
427
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
414
428
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
415
429
 
416
- expect(editorState.doc).toEqualDocument(expectedDoc);
430
+ expect(editorState.doc.toJSON()).toEqual(
431
+ expectedDoc(defaultSchema).toJSON(),
432
+ );
417
433
  },
418
434
  );
419
435
 
@@ -430,7 +446,9 @@ describe('AddColumnStep', () => {
430
446
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
431
447
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
432
448
 
433
- expect(editorState.doc).toEqualDocument(expectedDoc);
449
+ expect(editorState.doc.toJSON()).toEqual(
450
+ expectedDoc(defaultSchema).toJSON(),
451
+ );
434
452
  },
435
453
  );
436
454
  });
@@ -166,7 +166,9 @@ describe('AddColumnStep', () => {
166
166
  addColumnAtFactory('table', column)(editorState, refs),
167
167
  );
168
168
 
169
- expect(editorState.doc).toEqualDocument(expectedDoc);
169
+ expect(editorState.doc.toJSON()).toEqual(
170
+ expectedDoc(defaultSchema).toJSON(),
171
+ );
170
172
  },
171
173
  );
172
174
  });
@@ -184,7 +186,9 @@ describe('AddColumnStep', () => {
184
186
  removeColumnAtFactory('table', column)(editorState, refs),
185
187
  );
186
188
 
187
- expect(editorState.doc).toEqualDocument(expectedDoc);
189
+ expect(editorState.doc.toJSON()).toEqual(
190
+ expectedDoc(defaultSchema).toJSON(),
191
+ );
188
192
  },
189
193
  );
190
194
  });
@@ -214,7 +218,9 @@ describe('AddColumnStep', () => {
214
218
  transaction,
215
219
  editorState,
216
220
  );
217
- expect(editorState.doc).toEqualDocument(originalDoc);
221
+ expect(editorState.doc.toJSON()).toEqual(
222
+ originalDoc(defaultSchema).toJSON(),
223
+ );
218
224
  });
219
225
  });
220
226
 
@@ -323,7 +329,9 @@ describe('AddColumnStep', () => {
323
329
 
324
330
  editorState = editorState.apply(editorState.tr.step(addColumnStep!));
325
331
 
326
- expect(editorState.doc).toEqualDocument(expectedDoc);
332
+ expect(editorState.doc.toJSON()).toEqual(
333
+ expectedDoc(defaultSchema).toJSON(),
334
+ );
327
335
  },
328
336
  );
329
337
  });
@@ -343,7 +351,9 @@ describe('AddColumnStep', () => {
343
351
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
344
352
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
345
353
 
346
- expect(editorState.doc).toEqualDocument(expectedDoc);
354
+ expect(editorState.doc.toJSON()).toEqual(
355
+ expectedDoc(defaultSchema).toJSON(),
356
+ );
347
357
  },
348
358
  );
349
359
 
@@ -361,7 +371,9 @@ describe('AddColumnStep', () => {
361
371
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
362
372
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
363
373
 
364
- expect(editorState.doc).toEqualDocument(expectedDoc);
374
+ expect(editorState.doc.toJSON()).toEqual(
375
+ expectedDoc(defaultSchema).toJSON(),
376
+ );
365
377
  },
366
378
  );
367
379
 
@@ -376,7 +388,9 @@ describe('AddColumnStep', () => {
376
388
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
377
389
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
378
390
 
379
- expect(editorState.doc).toEqualDocument(expectedDoc);
391
+ expect(editorState.doc.toJSON()).toEqual(
392
+ expectedDoc(defaultSchema).toJSON(),
393
+ );
380
394
  },
381
395
  );
382
396
 
@@ -393,7 +407,9 @@ describe('AddColumnStep', () => {
393
407
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
394
408
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
395
409
 
396
- expect(editorState.doc).toEqualDocument(expectedDoc);
410
+ expect(editorState.doc.toJSON()).toEqual(
411
+ expectedDoc(defaultSchema).toJSON(),
412
+ );
397
413
  },
398
414
  );
399
415
  });
@@ -119,7 +119,9 @@ describe('AddColumnStep', () => {
119
119
  removeColumnAtFactory('table', 0)(editorState, refs),
120
120
  );
121
121
 
122
- expect(editorState.doc).toEqualDocument(doc(p('')));
122
+ expect(editorState.doc.toJSON()).toEqual(
123
+ doc(p(''))(defaultSchema).toJSON(),
124
+ );
123
125
  });
124
126
 
125
127
  it('should add the table after been removed it for a remove column', () => {
@@ -127,7 +129,9 @@ describe('AddColumnStep', () => {
127
129
  removeColumnAtFactory('table', 0)(editorState, refs),
128
130
  editorState,
129
131
  );
130
- expect(editorState.doc).toEqualDocument(threeByOne);
132
+ expect(editorState.doc.toJSON()).toEqual(
133
+ threeByOne(defaultSchema).toJSON(),
134
+ );
131
135
  });
132
136
 
133
137
  it('should remove the table after undoing the last column ', function () {
@@ -137,7 +141,9 @@ describe('AddColumnStep', () => {
137
141
  [removeColumnAtFactory('table', 1)],
138
142
  );
139
143
 
140
- expect(editorState.doc).toEqualDocument(doc(p('')));
144
+ expect(editorState.doc.toJSON()).toEqual(
145
+ doc(p(''))(defaultSchema).toJSON(),
146
+ );
141
147
  });
142
148
 
143
149
  it('should drop add column step when I remove the column', function () {
@@ -176,10 +182,14 @@ describe('AddColumnStep', () => {
176
182
 
177
183
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
178
184
 
185
+ const expectedDoc = doc(
186
+ p(''),
187
+ '{table}',
188
+ table()(tr(tdEmpty), tr(tdEmpty), tr(tdEmpty)),
189
+ )(defaultSchema).toJSON();
190
+
179
191
  // Should keep the new created single column and remove the old one
180
- expect(editorState.doc).toEqualDocument(
181
- doc(p(''), '{table}', table()(tr(tdEmpty), tr(tdEmpty), tr(tdEmpty))),
182
- );
192
+ expect(editorState.doc.toJSON()).toEqual(expectedDoc);
183
193
  });
184
194
 
185
195
  it('should parse a json that we just generate', function () {
@@ -216,7 +226,9 @@ describe('AddColumnStep', () => {
216
226
  editorState.tr.step(removeLastRowInverted),
217
227
  );
218
228
 
219
- expect(editorState.doc).toEqualDocument(threeByOne);
229
+ expect(editorState.doc.toJSON()).toEqual(
230
+ threeByOne(defaultSchema).toJSON(),
231
+ );
220
232
  });
221
233
 
222
234
  it('should remove the table when I received a JSON', () => {
@@ -229,7 +241,9 @@ describe('AddColumnStep', () => {
229
241
  editorState.tr.step(removeLastRowInverted),
230
242
  );
231
243
 
232
- expect(editorState.doc).toEqualDocument(doc(p('')));
244
+ expect(editorState.doc.toJSON()).toEqual(
245
+ doc(p(''))(defaultSchema).toJSON(),
246
+ );
233
247
  });
234
248
  });
235
249
 
@@ -313,7 +327,9 @@ describe('AddColumnStep', () => {
313
327
  addColumnAtFactory('table', column)(editorState, refs),
314
328
  );
315
329
 
316
- expect(editorState.doc).toEqualDocument(expectedDoc);
330
+ expect(editorState.doc.toJSON()).toEqual(
331
+ expectedDoc(defaultSchema).toJSON(),
332
+ );
317
333
  },
318
334
  );
319
335
  });
@@ -331,7 +347,9 @@ describe('AddColumnStep', () => {
331
347
  removeColumnAtFactory('table', column)(editorState, refs),
332
348
  );
333
349
 
334
- expect(editorState.doc).toEqualDocument(expectedDoc);
350
+ expect(editorState.doc.toJSON()).toEqual(
351
+ expectedDoc(defaultSchema).toJSON(),
352
+ );
335
353
  },
336
354
  );
337
355
  });
@@ -363,7 +381,9 @@ describe('AddColumnStep', () => {
363
381
  addColumnAtFactory('table', column)(editorState, refs),
364
382
  );
365
383
 
366
- expect(editorState.doc).toEqualDocument(expectedDoc);
384
+ expect(editorState.doc.toJSON()).toEqual(
385
+ expectedDoc(defaultSchema).toJSON(),
386
+ );
367
387
  },
368
388
  );
369
389
  });
@@ -381,7 +401,9 @@ describe('AddColumnStep', () => {
381
401
  removeColumnAtFactory('table', column)(editorState, refs),
382
402
  );
383
403
 
384
- expect(editorState.doc).toEqualDocument(expectedDoc);
404
+ expect(editorState.doc.toJSON()).toEqual(
405
+ expectedDoc(defaultSchema).toJSON(),
406
+ );
385
407
  },
386
408
  );
387
409
  });
@@ -432,7 +454,7 @@ describe('AddColumnStep', () => {
432
454
  transaction,
433
455
  editorState,
434
456
  );
435
- expect(editorState.doc).toEqualDocument(originalDoc);
457
+ expect(editorState.doc.toJSON()).toEqual(originalDoc.toJSON());
436
458
  });
437
459
  });
438
460
 
@@ -496,7 +518,9 @@ describe('AddColumnStep', () => {
496
518
 
497
519
  editorState = editorState.apply(editorState.tr.step(addColumnStep!));
498
520
 
499
- expect(editorState.doc).toEqualDocument(expectedDoc);
521
+ expect(editorState.doc.toJSON()).toEqual(
522
+ expectedDoc(defaultSchema).toJSON(),
523
+ );
500
524
  },
501
525
  );
502
526
  });
@@ -509,13 +533,13 @@ describe('AddColumnStep', () => {
509
533
  [addColumnAtFactory('table', 1), addColumnAtFactory('table', 1)],
510
534
  );
511
535
 
512
- expect(editorState.doc).toEqualDocument(
536
+ expect(editorState.doc.toJSON()).toEqual(
513
537
  doc(
514
538
  table()(
515
539
  tr(tdColorA, tdEmpty, tdEmpty, tdColorB, tdColorC),
516
540
  tr(tdColorA, tdEmpty, tdEmpty, tdColorB, tdColorC),
517
541
  ),
518
- ),
542
+ )(defaultSchema).toJSON(),
519
543
  );
520
544
  });
521
545
  });
@@ -533,7 +557,9 @@ describe('AddColumnStep', () => {
533
557
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
534
558
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
535
559
 
536
- expect(editorState.doc).toEqualDocument(expectedDoc);
560
+ expect(editorState.doc.toJSON()).toEqual(
561
+ expectedDoc(defaultSchema).toJSON(),
562
+ );
537
563
  },
538
564
  );
539
565
 
@@ -548,7 +574,9 @@ describe('AddColumnStep', () => {
548
574
  const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
549
575
  editorState = editorState.apply(editorState.tr.step(addColumnStep));
550
576
 
551
- expect(editorState.doc).toEqualDocument(expectedDoc);
577
+ expect(editorState.doc.toJSON()).toEqual(
578
+ expectedDoc(defaultSchema).toJSON(),
579
+ );
552
580
  },
553
581
  );
554
582
  });
@@ -1,4 +1,7 @@
1
- import { Node as ProseMirrorNode, Schema } from '@atlaskit/editor-prosemirror/model';
1
+ import {
2
+ Node as ProseMirrorNode,
3
+ Schema,
4
+ } from '@atlaskit/editor-prosemirror/model';
2
5
  import {
3
6
  Mappable,
4
7
  Step,
@@ -21,7 +21,10 @@ export interface Cell {
21
21
  * @param rect
22
22
  * @param col
23
23
  */
24
- export function* cellsAtColumn(rect: TableRect, col: number): Generator<Cell, void, number | undefined> {
24
+ export function* cellsAtColumn(
25
+ rect: TableRect,
26
+ col: number,
27
+ ): Generator<Cell, void, number | undefined> {
25
28
  const { map, tableStart, table } = rect;
26
29
 
27
30
  let refColumn: number | null = col > 0 ? -1 : 0;