@atlaskit/adf-schema 28.1.12 → 28.2.0
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 +12 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/json-schema/v1.ts +0 -55
- package/src/__tests__/unit/schema/create-schema.ts +0 -214
- package/src/__tests__/unit/schema/default-schema.ts +0 -192
- package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
- package/src/__tests__/unit/schema/marks/border.ts +0 -76
- package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
- package/src/__tests__/unit/schema/marks/code.ts +0 -44
- package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
- package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
- package/src/__tests__/unit/schema/marks/em.ts +0 -37
- package/src/__tests__/unit/schema/marks/link.ts +0 -188
- package/src/__tests__/unit/schema/marks/strike.ts +0 -37
- package/src/__tests__/unit/schema/marks/strong.ts +0 -43
- package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
- package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
- package/src/__tests__/unit/schema/marks/underline.ts +0 -36
- package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
- package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
- package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
- package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
- package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
- package/src/__tests__/unit/schema/nodes/date.ts +0 -51
- package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
- package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
- package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
- package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
- package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
- package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
- package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
- package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
- package/src/__tests__/unit/schema/nodes/image.ts +0 -32
- package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
- package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
- package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
- package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
- package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
- package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
- package/src/__tests__/unit/schema/nodes/media.ts +0 -384
- package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
- package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
- package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
- package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
- package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
- package/src/__tests__/unit/schema/nodes/status.ts +0 -120
- package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
- package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
- package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
- package/src/__tests__/unit/utils/colors.ts +0 -42
- package/src/__tests__/unit/utils/url.ts +0 -209
- package/src/schema/bitbucket-schema.ts +0 -43
- package/src/schema/confluence-schema.ts +0 -76
- package/src/schema/create-schema.ts +0 -337
- package/src/schema/default-schema.ts +0 -180
- package/src/schema/groups.ts +0 -30
- package/src/schema/inline-nodes.ts +0 -9
- package/src/schema/jira-schema.ts +0 -158
- package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
- package/src/schema/marks/alignment.ts +0 -48
- package/src/schema/marks/annotation.ts +0 -107
- package/src/schema/marks/border.ts +0 -74
- package/src/schema/marks/breakout.ts +0 -42
- package/src/schema/marks/code.ts +0 -45
- package/src/schema/marks/confluence-inline-comment.ts +0 -32
- package/src/schema/marks/data-consumer.ts +0 -100
- package/src/schema/marks/em.ts +0 -19
- package/src/schema/marks/fragment.ts +0 -77
- package/src/schema/marks/indentation.ts +0 -47
- package/src/schema/marks/link.ts +0 -139
- package/src/schema/marks/strike.ts +0 -26
- package/src/schema/marks/strong.ts +0 -45
- package/src/schema/marks/subsup.ts +0 -53
- package/src/schema/marks/text-color.ts +0 -172
- package/src/schema/marks/type-ahead-query.ts +0 -22
- package/src/schema/marks/underline.ts +0 -24
- package/src/schema/marks/unsupported-mark.ts +0 -9
- package/src/schema/marks/unsupported-node-attributes.ts +0 -8
- package/src/schema/nodes/block-card.ts +0 -121
- package/src/schema/nodes/blockquote.ts +0 -25
- package/src/schema/nodes/bodied-extension.ts +0 -75
- package/src/schema/nodes/bullet-list.ts +0 -17
- package/src/schema/nodes/caption.ts +0 -51
- package/src/schema/nodes/code-block.ts +0 -176
- package/src/schema/nodes/confluence-jira-issue.ts +0 -43
- package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
- package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
- package/src/schema/nodes/date.ts +0 -38
- package/src/schema/nodes/decision-item.ts +0 -50
- package/src/schema/nodes/decision-list.ts +0 -56
- package/src/schema/nodes/doc.ts +0 -30
- package/src/schema/nodes/embed-card.ts +0 -62
- package/src/schema/nodes/emoji.ts +0 -89
- package/src/schema/nodes/expand.ts +0 -101
- package/src/schema/nodes/extension.ts +0 -60
- package/src/schema/nodes/hard-break.ts +0 -21
- package/src/schema/nodes/heading.ts +0 -64
- package/src/schema/nodes/image.ts +0 -32
- package/src/schema/nodes/inline-card.ts +0 -70
- package/src/schema/nodes/inline-extension.ts +0 -57
- package/src/schema/nodes/layout-column.ts +0 -68
- package/src/schema/nodes/layout-section.ts +0 -93
- package/src/schema/nodes/list-item.ts +0 -13
- package/src/schema/nodes/media-group.ts +0 -44
- package/src/schema/nodes/media-inline.ts +0 -19
- package/src/schema/nodes/media-single.ts +0 -179
- package/src/schema/nodes/media.ts +0 -253
- package/src/schema/nodes/mention.ts +0 -86
- package/src/schema/nodes/nested-expand.ts +0 -77
- package/src/schema/nodes/ordered-list.ts +0 -62
- package/src/schema/nodes/panel.ts +0 -133
- package/src/schema/nodes/paragraph.ts +0 -79
- package/src/schema/nodes/placeholder.ts +0 -40
- package/src/schema/nodes/rule.ts +0 -17
- package/src/schema/nodes/status.ts +0 -58
- package/src/schema/nodes/tableNodes.ts +0 -478
- package/src/schema/nodes/task-item.ts +0 -51
- package/src/schema/nodes/task-list.ts +0 -61
- package/src/schema/nodes/text.ts +0 -19
- package/src/schema/nodes/types/block-content.ts +0 -51
- package/src/schema/nodes/types/extensions.ts +0 -36
- package/src/schema/nodes/types/inline-content.ts +0 -56
- package/src/schema/nodes/types/list.ts +0 -54
- package/src/schema/nodes/types/mark.ts +0 -16
- package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
- package/src/schema/nodes/types/rich-media-common.ts +0 -51
- package/src/schema/nodes/unknown-block.ts +0 -13
- package/src/schema/nodes/unsupported-block.ts +0 -28
- package/src/schema/nodes/unsupported-inline.ts +0 -27
- package/src/schema/unsupported.ts +0 -4
- package/src/steps/__tests__/unit/analytics.ts +0 -72
- package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
- package/src/steps/__tests__/unit/override-document-step.ts +0 -174
- package/src/steps/__tests__/unit/set-attrs.ts +0 -71
- package/src/steps/analytics.ts +0 -189
- package/src/steps/link-meta-step.ts +0 -105
- package/src/steps/override-document-step.ts +0 -97
- package/src/steps/set-attrs.tsx +0 -74
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
- package/src/steps/table/__tests__/_utils.ts +0 -102
- package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
- package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
- package/src/steps/table/__tests__/add-column.ts +0 -638
- package/src/steps/table/add-column.ts +0 -443
- package/src/steps/table/constants.ts +0 -4
- package/src/steps/table/sort-column.ts +0 -57
- package/src/steps/table/types.ts +0 -48
- package/src/steps/table/utils/cell-step.ts +0 -239
- package/src/steps/table/utils/cells-at-column.ts +0 -75
- package/src/steps/table/utils/find-column.ts +0 -90
- package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
- package/src/steps/table/utils/side-effects/rows.ts +0 -327
- package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
- package/src/steps/table/utils/side-effects/table.ts +0 -112
- package/src/steps/table/utils/side-effects/types.ts +0 -34
- package/src/steps/table/utils/table-map.ts +0 -28
- package/src/steps/type-ahead.ts +0 -100
- package/src/steps.ts +0 -16
- package/src/utils/colors.ts +0 -171
- package/src/utils/confluence/emoji.ts +0 -99
- package/src/utils/extensions.ts +0 -32
- package/src/utils/parseDOM.ts +0 -2
- package/src/utils/url.ts +0 -173
- package/src/utils/uuid.ts +0 -19
- package/src/version.json +0 -6
package/CHANGELOG.md
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette,
|
2
2
|
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
3
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, } from './schema';
|
4
|
-
export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DatasourceAttributes, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, BorderMarkAttributes, BorderMarkDefinition, } from './schema';
|
4
|
+
export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DatasourceAttributes, DatasourceAttributeProperties, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, BorderMarkAttributes, BorderMarkDefinition, } from './schema';
|
5
5
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, } from './utils';
|
6
6
|
export type { Match, NameToEmoji } from './utils';
|
package/package.json
CHANGED
@@ -1,55 +0,0 @@
|
|
1
|
-
import { initialize } from 'adf-test-helpers/src/ajv';
|
2
|
-
|
3
|
-
import v1SchemaFull from '../../../../json-schema/v1/full.json';
|
4
|
-
import v1SchemaStage0 from '../../../../json-schema/v1/stage-0.json';
|
5
|
-
|
6
|
-
import {
|
7
|
-
fullValidJsonSchema,
|
8
|
-
fullInvalidJsonSchema,
|
9
|
-
stage0ValidJsonSchema,
|
10
|
-
stage0InvalidJsonSchema,
|
11
|
-
} from '@atlassian/adf-schema-json';
|
12
|
-
|
13
|
-
const ajv = initialize();
|
14
|
-
const packageName = process.env._PACKAGE_NAME_ as string;
|
15
|
-
|
16
|
-
describe(`${packageName} json-schema v1`, () => {
|
17
|
-
const validateFull = ajv.compile(v1SchemaFull);
|
18
|
-
const validateStage0 = ajv.compile(v1SchemaStage0);
|
19
|
-
|
20
|
-
describe('full', () => {
|
21
|
-
for (const file of fullValidJsonSchema) {
|
22
|
-
it(`validates '${file.name}'`, () => {
|
23
|
-
validateFull(file.data);
|
24
|
-
expect(validateFull.errors).toEqual(null);
|
25
|
-
// Valid `full` use cases should be valid against `stage-0` schema
|
26
|
-
validateStage0(file.data);
|
27
|
-
expect(validateStage0.errors).toEqual(null);
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
|
-
for (const file of fullInvalidJsonSchema) {
|
32
|
-
it(`does not validate '${file.name}'`, () => {
|
33
|
-
expect(validateFull(file.data)).toEqual(false);
|
34
|
-
});
|
35
|
-
}
|
36
|
-
});
|
37
|
-
|
38
|
-
describe('stage-0', () => {
|
39
|
-
for (const file of stage0ValidJsonSchema) {
|
40
|
-
it(`validates '${file.name}'`, () => {
|
41
|
-
validateStage0(file.data);
|
42
|
-
expect(validateStage0.errors).toEqual(null);
|
43
|
-
|
44
|
-
// Valid `stage-0` use cases should be invalid against `full` schema
|
45
|
-
expect(validateFull(file.data)).toEqual(false);
|
46
|
-
});
|
47
|
-
}
|
48
|
-
|
49
|
-
for (const file of stage0InvalidJsonSchema) {
|
50
|
-
it(`does not validate '${file.name}'`, () => {
|
51
|
-
expect(validateStage0(file.data)).toEqual(false);
|
52
|
-
});
|
53
|
-
}
|
54
|
-
});
|
55
|
-
});
|
@@ -1,214 +0,0 @@
|
|
1
|
-
const packageName = process.env._PACKAGE_NAME_ as string;
|
2
|
-
import { code as codeBase, createSchema, sanitizeNodes } from '../../..';
|
3
|
-
import { sanitizeNodeSpecContent } from '../../../schema/create-schema';
|
4
|
-
const filterGroupDecMark = (marks: Array<string>) =>
|
5
|
-
marks.filter((mark) => mark[0] !== '_' || mark[1] !== '_');
|
6
|
-
|
7
|
-
describe(`${packageName}/schema createSchema helper`, () => {
|
8
|
-
it('should add only defined marks and nodes to the schema', () => {
|
9
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
10
|
-
const marksConfig = ['em', 'strong', 'strike'];
|
11
|
-
const schema = createSchema({ nodes: nodesConfig, marks: marksConfig });
|
12
|
-
const nodes = Object.keys(schema.nodes);
|
13
|
-
const marks = filterGroupDecMark(Object.keys(schema.marks));
|
14
|
-
expect(nodes).toEqual(['doc', 'paragraph', 'text']);
|
15
|
-
expect(marks).toEqual(['em', 'strong', 'strike']);
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should preserv order for marks and nodes in the schema', () => {
|
19
|
-
const nodesConfig = ['text', 'doc', 'paragraph'];
|
20
|
-
const marksConfig = ['strong', 'strike', 'em'];
|
21
|
-
const schema = createSchema({ nodes: nodesConfig, marks: marksConfig });
|
22
|
-
const nodes = Object.keys(schema.nodes);
|
23
|
-
const marks = filterGroupDecMark(Object.keys(schema.marks));
|
24
|
-
expect(nodes).toEqual(['doc', 'paragraph', 'text']);
|
25
|
-
expect(marks).toEqual(['em', 'strong', 'strike']);
|
26
|
-
});
|
27
|
-
|
28
|
-
it('should allow custom node spec for built-in node type', () => {
|
29
|
-
const listItem = {
|
30
|
-
content: 'paragraph block*',
|
31
|
-
parseDOM: [{ tag: 'div' }],
|
32
|
-
};
|
33
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
34
|
-
const schema = createSchema({
|
35
|
-
nodes: nodesConfig,
|
36
|
-
customNodeSpecs: { listItem },
|
37
|
-
});
|
38
|
-
const nodes = Object.keys(schema.nodes);
|
39
|
-
expect(nodes).toEqual(['doc', 'paragraph', 'text', 'listItem']);
|
40
|
-
expect(schema.nodes.listItem.spec).toEqual(listItem);
|
41
|
-
});
|
42
|
-
|
43
|
-
it('should allow custom node spec', () => {
|
44
|
-
const jiraIssue = {
|
45
|
-
content: 'paragraph block*',
|
46
|
-
parseDOM: [{ tag: 'div' }],
|
47
|
-
};
|
48
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
49
|
-
const schema = createSchema({
|
50
|
-
nodes: nodesConfig,
|
51
|
-
customNodeSpecs: { jiraIssue },
|
52
|
-
});
|
53
|
-
const nodes = Object.keys(schema.nodes);
|
54
|
-
expect(nodes).toEqual(['doc', 'paragraph', 'text', 'jiraIssue']);
|
55
|
-
});
|
56
|
-
|
57
|
-
it('should allow custom mark spec for built-in mark type', () => {
|
58
|
-
const code = { ...codeBase, excludes: 'em' };
|
59
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
60
|
-
const marksConfig = ['em'];
|
61
|
-
const schema = createSchema({
|
62
|
-
nodes: nodesConfig,
|
63
|
-
marks: marksConfig,
|
64
|
-
customMarkSpecs: { code },
|
65
|
-
});
|
66
|
-
const marks = filterGroupDecMark(Object.keys(schema.marks));
|
67
|
-
expect(marks).toEqual(['em', 'code']);
|
68
|
-
expect(schema.marks.code.spec).toEqual(code);
|
69
|
-
});
|
70
|
-
|
71
|
-
it('should allow custom mark spec', () => {
|
72
|
-
const monospace = { ...codeBase, excludes: 'em' };
|
73
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
74
|
-
const marksConfig = ['em'];
|
75
|
-
const schema = createSchema({
|
76
|
-
nodes: nodesConfig,
|
77
|
-
marks: marksConfig,
|
78
|
-
customMarkSpecs: { monospace },
|
79
|
-
});
|
80
|
-
const marks = filterGroupDecMark(Object.keys(schema.marks));
|
81
|
-
expect(marks).toEqual(['em', 'monospace']);
|
82
|
-
expect(schema.marks.monospace.spec).toEqual(monospace);
|
83
|
-
});
|
84
|
-
|
85
|
-
it('should allow only custom mark spec', () => {
|
86
|
-
const code = { ...codeBase, excludes: '' };
|
87
|
-
const nodesConfig = ['doc', 'paragraph', 'text'];
|
88
|
-
const schema = createSchema({
|
89
|
-
nodes: nodesConfig,
|
90
|
-
customMarkSpecs: { code },
|
91
|
-
});
|
92
|
-
expect(schema.marks.code.spec).toEqual(code);
|
93
|
-
});
|
94
|
-
|
95
|
-
describe('fixNodeContentSchema', () => {
|
96
|
-
it('excludes unsupported nodes in node content', () => {
|
97
|
-
const nodes = {
|
98
|
-
node1: {
|
99
|
-
content: 'node1 | nodeDoesNotExist | node2 | anotherNodeDoesNotExist',
|
100
|
-
},
|
101
|
-
node2: {
|
102
|
-
content: 'node2',
|
103
|
-
},
|
104
|
-
};
|
105
|
-
const sanitizedNodes = sanitizeNodes(nodes, {});
|
106
|
-
|
107
|
-
expect(sanitizedNodes).toEqual({
|
108
|
-
node1: {
|
109
|
-
content: 'node1 | node2',
|
110
|
-
},
|
111
|
-
node2: {
|
112
|
-
content: 'node2',
|
113
|
-
},
|
114
|
-
});
|
115
|
-
});
|
116
|
-
|
117
|
-
it('excludes unsupported nodes in node content - 2', () => {
|
118
|
-
const nodes = {
|
119
|
-
node1: {
|
120
|
-
content:
|
121
|
-
'(node1 | nodeDoesNotExist | anotherNodeDoesNotExist | node2)*',
|
122
|
-
},
|
123
|
-
node2: {
|
124
|
-
content: 'node2',
|
125
|
-
},
|
126
|
-
};
|
127
|
-
const sanitizedNodes = sanitizeNodes(nodes, {});
|
128
|
-
|
129
|
-
expect(sanitizedNodes).toEqual({
|
130
|
-
node1: {
|
131
|
-
content: '(node1 | node2)*',
|
132
|
-
},
|
133
|
-
node2: {
|
134
|
-
content: 'node2',
|
135
|
-
},
|
136
|
-
});
|
137
|
-
});
|
138
|
-
|
139
|
-
it('does not generate invalid content', () => {
|
140
|
-
const nodes = {
|
141
|
-
node1: {
|
142
|
-
content: 'nodeDoesNotExist | anotherNodeDoesNotExist',
|
143
|
-
},
|
144
|
-
node2: {
|
145
|
-
content: 'node2 | nodeDoesNotExist',
|
146
|
-
},
|
147
|
-
};
|
148
|
-
const sanitizedNodes = sanitizeNodes(nodes, {});
|
149
|
-
|
150
|
-
expect(sanitizedNodes).toEqual({
|
151
|
-
node1: {
|
152
|
-
content: '',
|
153
|
-
},
|
154
|
-
node2: {
|
155
|
-
content: 'node2',
|
156
|
-
},
|
157
|
-
});
|
158
|
-
});
|
159
|
-
|
160
|
-
it('should remove unsupported block from content', () => {
|
161
|
-
const nodes = {
|
162
|
-
node1: {
|
163
|
-
content: '(node2 | unsupportedBlock){2,3} unsupportedBlock*',
|
164
|
-
},
|
165
|
-
node2: { content: 'node2' },
|
166
|
-
};
|
167
|
-
const content = '(node2 | unsupportedBlock){2,3} unsupportedBlock*';
|
168
|
-
expect(sanitizeNodeSpecContent(nodes, content)).toEqual('(node2 ){2,3}');
|
169
|
-
});
|
170
|
-
|
171
|
-
it('modifies node immutably', () => {
|
172
|
-
const nodeSpec = {
|
173
|
-
content: 'nodeDoesNotExist',
|
174
|
-
};
|
175
|
-
const nodes = {
|
176
|
-
node: nodeSpec,
|
177
|
-
};
|
178
|
-
const sanitizedNodes = sanitizeNodes(nodes, {});
|
179
|
-
|
180
|
-
expect(sanitizedNodes).toEqual({
|
181
|
-
node: {
|
182
|
-
content: '',
|
183
|
-
},
|
184
|
-
});
|
185
|
-
|
186
|
-
expect(nodeSpec).toEqual({
|
187
|
-
content: 'nodeDoesNotExist',
|
188
|
-
});
|
189
|
-
});
|
190
|
-
|
191
|
-
it('recognizes node from group', () => {
|
192
|
-
const nodes = {
|
193
|
-
node1: {
|
194
|
-
content: 'inline+',
|
195
|
-
group: 'block',
|
196
|
-
},
|
197
|
-
node2: {
|
198
|
-
group: 'inline',
|
199
|
-
},
|
200
|
-
};
|
201
|
-
const sanitizedNodes = sanitizeNodes(nodes, {});
|
202
|
-
|
203
|
-
expect(sanitizedNodes).toEqual({
|
204
|
-
node1: {
|
205
|
-
content: 'inline+',
|
206
|
-
group: 'block',
|
207
|
-
},
|
208
|
-
node2: {
|
209
|
-
group: 'inline',
|
210
|
-
},
|
211
|
-
});
|
212
|
-
});
|
213
|
-
});
|
214
|
-
});
|
@@ -1,192 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
defaultSchema,
|
3
|
-
getSchemaBasedOnStage,
|
4
|
-
} from '../../../schema/default-schema';
|
5
|
-
|
6
|
-
describe('Default Schema', () => {
|
7
|
-
describe('Nodes', () => {
|
8
|
-
it('should contain the `mediaInline` node', () => {
|
9
|
-
expect(defaultSchema.nodes.mediaInline).toBeDefined();
|
10
|
-
});
|
11
|
-
});
|
12
|
-
|
13
|
-
describe('Marks', () => {
|
14
|
-
it('should contain the `typeAheadQuery` mark', () => {
|
15
|
-
expect(defaultSchema.marks.typeAheadQuery).toBeDefined();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should contain the `fragment` mark', () => {
|
19
|
-
expect(defaultSchema.marks.fragment).toBeDefined();
|
20
|
-
});
|
21
|
-
});
|
22
|
-
});
|
23
|
-
|
24
|
-
describe('Get Schema Based On Stage', () => {
|
25
|
-
describe('Default / Full Schema', () => {
|
26
|
-
it('should contain the nodes', () => {
|
27
|
-
const schema = getSchemaBasedOnStage();
|
28
|
-
expect(Object.keys(schema.nodes)).toEqual([
|
29
|
-
'doc',
|
30
|
-
'paragraph',
|
31
|
-
'text',
|
32
|
-
'bulletList',
|
33
|
-
'orderedList',
|
34
|
-
'listItem',
|
35
|
-
'heading',
|
36
|
-
'blockquote',
|
37
|
-
'codeBlock',
|
38
|
-
'panel',
|
39
|
-
'rule',
|
40
|
-
'image',
|
41
|
-
'mention',
|
42
|
-
'caption',
|
43
|
-
'media',
|
44
|
-
'mediaGroup',
|
45
|
-
'mediaSingle',
|
46
|
-
'mediaInline',
|
47
|
-
'placeholder',
|
48
|
-
'layoutSection',
|
49
|
-
'layoutColumn',
|
50
|
-
'hardBreak',
|
51
|
-
'emoji',
|
52
|
-
'table',
|
53
|
-
'tableCell',
|
54
|
-
'tableRow',
|
55
|
-
'tableHeader',
|
56
|
-
'confluenceJiraIssue',
|
57
|
-
'confluenceUnsupportedInline',
|
58
|
-
'confluenceUnsupportedBlock',
|
59
|
-
'decisionList',
|
60
|
-
'decisionItem',
|
61
|
-
'taskList',
|
62
|
-
'taskItem',
|
63
|
-
'date',
|
64
|
-
'status',
|
65
|
-
'expand',
|
66
|
-
'nestedExpand',
|
67
|
-
'extension',
|
68
|
-
'inlineExtension',
|
69
|
-
'bodiedExtension',
|
70
|
-
'inlineCard',
|
71
|
-
'blockCard',
|
72
|
-
'embedCard',
|
73
|
-
'unknownBlock',
|
74
|
-
'unsupportedBlock',
|
75
|
-
'unsupportedInline',
|
76
|
-
]);
|
77
|
-
});
|
78
|
-
|
79
|
-
it('should contain the marks', () => {
|
80
|
-
const schema = getSchemaBasedOnStage();
|
81
|
-
expect(Object.keys(schema.marks)).toEqual([
|
82
|
-
'link',
|
83
|
-
'em',
|
84
|
-
'strong',
|
85
|
-
'textColor',
|
86
|
-
'strike',
|
87
|
-
'subsup',
|
88
|
-
'underline',
|
89
|
-
'code',
|
90
|
-
'typeAheadQuery',
|
91
|
-
'alignment',
|
92
|
-
'annotation',
|
93
|
-
'confluenceInlineComment',
|
94
|
-
'__colorGroupDeclaration',
|
95
|
-
'__fontStyleGroupDeclaration',
|
96
|
-
'__searchQueryGroupDeclaration',
|
97
|
-
'__linkGroupDeclaration',
|
98
|
-
'breakout',
|
99
|
-
'dataConsumer',
|
100
|
-
'fragment',
|
101
|
-
'indentation',
|
102
|
-
'border',
|
103
|
-
'unsupportedMark',
|
104
|
-
'unsupportedNodeAttribute',
|
105
|
-
]);
|
106
|
-
});
|
107
|
-
});
|
108
|
-
|
109
|
-
describe('Stage-0', () => {
|
110
|
-
it('should contain the nodes', () => {
|
111
|
-
const schema = getSchemaBasedOnStage('stage0');
|
112
|
-
expect(Object.keys(schema.nodes)).toEqual([
|
113
|
-
'doc',
|
114
|
-
'paragraph',
|
115
|
-
'text',
|
116
|
-
'bulletList',
|
117
|
-
'orderedList',
|
118
|
-
'listItem',
|
119
|
-
'heading',
|
120
|
-
'blockquote',
|
121
|
-
'codeBlock',
|
122
|
-
'panel',
|
123
|
-
'rule',
|
124
|
-
'image',
|
125
|
-
'mention',
|
126
|
-
'caption',
|
127
|
-
'media',
|
128
|
-
'mediaGroup',
|
129
|
-
'mediaSingle',
|
130
|
-
'mediaInline',
|
131
|
-
'placeholder',
|
132
|
-
'layoutSection',
|
133
|
-
'layoutColumn',
|
134
|
-
'hardBreak',
|
135
|
-
'emoji',
|
136
|
-
'table',
|
137
|
-
'tableCell',
|
138
|
-
'tableRow',
|
139
|
-
'tableHeader',
|
140
|
-
'confluenceJiraIssue',
|
141
|
-
'confluenceUnsupportedInline',
|
142
|
-
'confluenceUnsupportedBlock',
|
143
|
-
'decisionList',
|
144
|
-
'decisionItem',
|
145
|
-
'taskList',
|
146
|
-
'taskItem',
|
147
|
-
'date',
|
148
|
-
'status',
|
149
|
-
'expand',
|
150
|
-
'nestedExpand',
|
151
|
-
'extension',
|
152
|
-
'inlineExtension',
|
153
|
-
'bodiedExtension',
|
154
|
-
'inlineCard',
|
155
|
-
'blockCard',
|
156
|
-
'embedCard',
|
157
|
-
'unknownBlock',
|
158
|
-
'unsupportedBlock',
|
159
|
-
'unsupportedInline',
|
160
|
-
]);
|
161
|
-
});
|
162
|
-
|
163
|
-
it('should contain the marks', () => {
|
164
|
-
const schema = getSchemaBasedOnStage('stage0');
|
165
|
-
expect(Object.keys(schema.marks)).toEqual([
|
166
|
-
'link',
|
167
|
-
'em',
|
168
|
-
'strong',
|
169
|
-
'textColor',
|
170
|
-
'strike',
|
171
|
-
'subsup',
|
172
|
-
'underline',
|
173
|
-
'code',
|
174
|
-
'typeAheadQuery',
|
175
|
-
'alignment',
|
176
|
-
'annotation',
|
177
|
-
'confluenceInlineComment',
|
178
|
-
'__colorGroupDeclaration',
|
179
|
-
'__fontStyleGroupDeclaration',
|
180
|
-
'__searchQueryGroupDeclaration',
|
181
|
-
'__linkGroupDeclaration',
|
182
|
-
'breakout',
|
183
|
-
'dataConsumer',
|
184
|
-
'fragment',
|
185
|
-
'indentation',
|
186
|
-
'border',
|
187
|
-
'unsupportedMark',
|
188
|
-
'unsupportedNodeAttribute',
|
189
|
-
]);
|
190
|
-
});
|
191
|
-
});
|
192
|
-
});
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { createSchema } from '../../../../schema/create-schema';
|
2
|
-
import { toHTML, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
3
|
-
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
4
|
-
|
5
|
-
const packageName = process.env._PACKAGE_NAME_ as string;
|
6
|
-
|
7
|
-
describe(`${packageName}/schema confluence-inline-comment mark`, () => {
|
8
|
-
let schema: Schema;
|
9
|
-
beforeEach(() => {
|
10
|
-
schema = makeSchema();
|
11
|
-
});
|
12
|
-
|
13
|
-
it('serializes to the correct HTML', () => {
|
14
|
-
const node = schema.text('foo', [
|
15
|
-
schema.marks.annotation.create({
|
16
|
-
id: 'hash-ref-goes-here',
|
17
|
-
}),
|
18
|
-
]);
|
19
|
-
|
20
|
-
const html = toHTML(node, schema);
|
21
|
-
expect(html).toContain('data-id="hash-ref-goes-here"');
|
22
|
-
expect(html).toContain('data-mark-type="annotation"');
|
23
|
-
expect(html).toContain('data-mark-annotation-type="inlineComment"');
|
24
|
-
});
|
25
|
-
|
26
|
-
it('parses annotation correctly from html', () => {
|
27
|
-
const doc = fromHTML(
|
28
|
-
`<p><span data-mark-type="annotation" data-mark-annotation-type="inlineComment" data-id="comment-id" >annotated text</span></p>`,
|
29
|
-
schema,
|
30
|
-
);
|
31
|
-
const annotationNode = doc.firstChild!.firstChild!;
|
32
|
-
expect(annotationNode.marks).toHaveLength(1);
|
33
|
-
expect(annotationNode.marks[0].type.name).toBe('annotation');
|
34
|
-
expect(annotationNode.marks[0].attrs).toEqual({
|
35
|
-
id: 'comment-id',
|
36
|
-
annotationType: 'inlineComment',
|
37
|
-
});
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
function makeSchema() {
|
42
|
-
return createSchema({
|
43
|
-
nodes: ['doc', 'paragraph', 'text'],
|
44
|
-
marks: ['annotation'],
|
45
|
-
});
|
46
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
import { createSchema } from '../../../../schema/create-schema';
|
2
|
-
import { fromHTML, toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
3
|
-
|
4
|
-
const testAttr = { color: '#172B4D', size: 1 };
|
5
|
-
const testAttrFalse = { color: '#12345', size: 0 };
|
6
|
-
const packageName = process.env._PACKAGE_NAME_ as string;
|
7
|
-
|
8
|
-
describe(`${packageName}/schema border mark`, () => {
|
9
|
-
it('serializes to the correct HTML', () => {
|
10
|
-
const schema = makeSchema();
|
11
|
-
const node = schema.nodes.media.create(
|
12
|
-
{},
|
13
|
-
[],
|
14
|
-
[schema.marks.border.create(testAttr)],
|
15
|
-
);
|
16
|
-
const html = toHTML(node, schema);
|
17
|
-
expect(html).toContain(
|
18
|
-
`data-mark-type="border" data-color="#172B4D" data-size="1" style="--custom-palette-color: var(--ds-text, #172B4D)"`,
|
19
|
-
);
|
20
|
-
});
|
21
|
-
});
|
22
|
-
|
23
|
-
it('should parse border with color in lower case', () => {
|
24
|
-
const schema = makeSchema();
|
25
|
-
const doc = fromHTML(
|
26
|
-
`<div data-mark-type="border" data-color="${testAttr.color}" data-size="${testAttr.size}"><div data-node-type="media" data-type="file" data-id="dummy-id"></div></div>`,
|
27
|
-
schema,
|
28
|
-
);
|
29
|
-
const dataConsumerNode = doc.firstChild!.firstChild!;
|
30
|
-
|
31
|
-
expect(dataConsumerNode.marks).toHaveLength(1);
|
32
|
-
expect(dataConsumerNode.marks[0].type.name).toBe('border');
|
33
|
-
expect(dataConsumerNode.marks[0].attrs).toEqual({
|
34
|
-
size: testAttr.size,
|
35
|
-
color: '#172b4d',
|
36
|
-
});
|
37
|
-
});
|
38
|
-
|
39
|
-
it('should parse border with attributes as false if size and color are not expected values', () => {
|
40
|
-
const schema = makeSchema();
|
41
|
-
const doc = fromHTML(
|
42
|
-
`<div data-mark-type="border" data-color="${testAttrFalse.color}" data-size="${testAttrFalse.size}"><div data-node-type="media" data-type="file" data-id="dummy-id"></div></div>`,
|
43
|
-
schema,
|
44
|
-
);
|
45
|
-
const dataConsumerNode = doc.firstChild!.firstChild!;
|
46
|
-
|
47
|
-
expect(dataConsumerNode.marks).toHaveLength(1);
|
48
|
-
expect(dataConsumerNode.marks[0].type.name).toBe('border');
|
49
|
-
expect(dataConsumerNode.marks[0].attrs).toEqual({
|
50
|
-
size: false,
|
51
|
-
color: false,
|
52
|
-
});
|
53
|
-
});
|
54
|
-
|
55
|
-
it('should parse maximum size as 3', () => {
|
56
|
-
const schema = makeSchema();
|
57
|
-
const doc = fromHTML(
|
58
|
-
`<div data-mark-type="border" data-color="${testAttr.color}" data-size=5><div data-node-type="media" data-type="file" data-id="dummy-id"></div></div>`,
|
59
|
-
schema,
|
60
|
-
);
|
61
|
-
const dataConsumerNode = doc.firstChild!.firstChild!;
|
62
|
-
|
63
|
-
expect(dataConsumerNode.marks).toHaveLength(1);
|
64
|
-
expect(dataConsumerNode.marks[0].type.name).toBe('border');
|
65
|
-
expect(dataConsumerNode.marks[0].attrs).toEqual({
|
66
|
-
size: 3,
|
67
|
-
color: '#172b4d',
|
68
|
-
});
|
69
|
-
});
|
70
|
-
|
71
|
-
function makeSchema() {
|
72
|
-
return createSchema({
|
73
|
-
nodes: ['doc', 'paragraph', 'text', 'mediaSingle', 'media', 'caption'],
|
74
|
-
marks: ['border'],
|
75
|
-
});
|
76
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { createSchema } from '../../../../schema/create-schema';
|
2
|
-
import { toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
3
|
-
|
4
|
-
const packageName = process.env._PACKAGE_NAME_ as string;
|
5
|
-
|
6
|
-
describe(`${packageName}/schema breakout mark`, () => {
|
7
|
-
it('serializes to the correct HTML', () => {
|
8
|
-
const schema = makeSchema();
|
9
|
-
const node = schema.nodes.codeBlock.create(
|
10
|
-
{},
|
11
|
-
[],
|
12
|
-
[schema.marks.breakout.create({ mode: 'wide' })],
|
13
|
-
);
|
14
|
-
const html = toHTML(node, schema);
|
15
|
-
expect(html).toContain('data-mode="wide"');
|
16
|
-
});
|
17
|
-
});
|
18
|
-
|
19
|
-
function makeSchema() {
|
20
|
-
return createSchema({
|
21
|
-
nodes: ['doc', 'paragraph', 'text', 'codeBlock'],
|
22
|
-
marks: ['breakout'],
|
23
|
-
});
|
24
|
-
}
|