@designcrowd/library.brand-page 6.1.1-json-prereq-3 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/{CreatedOnBrandCrowd-de-de-hj_ievMc.js → CreatedOnBrandCrowd-de-de-B5B5ThJ6.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-jAOSpfCw.js → CreatedOnBrandCrowd-en-us-a48CaORy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DZMVc-y3.js → CreatedOnBrandCrowd-es-es-xpuZ317-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-DvB54H38.js → CreatedOnBrandCrowd-fr-ca-V-iUMArW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-DvB54H38.js → CreatedOnBrandCrowd-fr-fr-V-iUMArW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-bf-x1xhi.js → CreatedOnBrandCrowd-pt-br-DZ0NKSAy.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-bf-x1xhi.js → CreatedOnBrandCrowd-pt-pt-DZ0NKSAy.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-B-NY1B44.js → CreatedOnDcom-de-de-_950cgGp.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Cd4C6KQf.js → CreatedOnDcom-en-us-DogKzH-g.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DONlsQsm.js → CreatedOnDcom-es-es-CmGM3IPX.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Dsv3FRpZ.js → CreatedOnDcom-fr-ca-BonEDkWZ.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DOgyvY5C.js → CreatedOnDcom-fr-fr-DQHtKrd_.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DX66MhJS.js → CreatedOnDcom-pt-br-CtYJSBjs.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-COe2G0bU.js → CreatedOnDcom-pt-pt-DoO9r4lA.js} +1 -1
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +7 -8
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +6 -4
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.js +4 -1
- package/lib/src/brand-page/components/payment/Payment.mixin.js +4 -3
- package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +1 -0
- package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +1 -0
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.js +4 -1
- package/lib/src/brand-page/composables/consent.composable.d.ts +2 -0
- package/lib/src/brand-page/composables/consent.composable.js +9 -3
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +7 -0
- package/lib/src/brand-page/models/index.d.ts +26 -34
- package/lib/src/brand-page/utils/context.util.d.ts +8 -0
- package/lib/src/brand-page/utils/context.util.js +8 -0
- package/lib/src/brand-page/utils/migration.util.js +0 -11
- package/lib/src/brand-page/utils/text.util.d.ts +1 -13
- package/lib/src/brand-page/utils/text.util.js +0 -64
- package/lib/src/brand-page/utils/vcard.util.js +4 -4
- package/lib/src/brand-page/utils/view-model.util.d.ts +0 -1
- package/lib/src/brand-page/utils/view-model.util.js +20 -68
- package/lib/src/brand-page/view-models.d.ts +3 -3
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +51 -18
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.d.ts +9 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.js +10 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.d.ts +27 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.js +44 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +103 -24
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +8 -0
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +9 -3
- package/lib/src/brand-page-maker/stores/ui/ui-store.d.ts +1 -1
- package/lib/src/brand-page-maker/utils/index.d.ts +0 -2
- package/lib/src/brand-page-maker/utils/index.js +0 -2
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +5 -28
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +5 -48
- package/lib/src/brand-page-maker/validators/field.validator.js +2 -10
- package/lib/src/clients/models.d.ts +2 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +99 -102
- package/lib/src/css/library.brand-page-brandPage.min.css +99 -102
- package/lib/src/css/library.brand-page-designCom.min.css +99 -102
- package/lib/src/css/library.brand-page-preview.min.css +99 -102
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.mjs +219 -221
- package/lib/src/{lib-scDtk-Pi.js → lib-DtalJKI3.js} +72445 -75920
- package/lib/src/lib.js +1 -2
- package/lib/src/metadata-builder/ai-metadata-executor.d.ts +1 -0
- package/lib/src/metadata-builder/ai-metadata-executor.js +19 -0
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +4 -3
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +3 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +2 -1
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +11 -15
- package/lib/src/metadata-builder/builders/update-content-text-builder.d.ts +17 -0
- package/lib/src/metadata-builder/builders/update-content-text-builder.js +103 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.d.ts +16 -0
- package/lib/src/metadata-builder/builders/update-content-text-style-builder.js +216 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +13 -11
- package/lib/src/metadata-builder/helpers/rte.helpers.js +73 -14
- package/lib/src/metadata-builder/metadata-executor.js +4 -0
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/models.js +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +19 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.js +4 -0
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.d.ts +8 -7
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +52 -21
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.js +10 -35
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +3 -12
- package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.d.ts +2 -3
- package/lib/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.js +3 -10
- package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +1 -4
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -1
- package/lib/src/shared/logo-versions/LogoVersions.mixin.d.ts +1 -1
- package/lib/src/shared/my-designs/MyDesigns.mixin.d.ts +1 -1
- package/lib/src/shared/my-uploads/MyMedia.mixin.d.ts +1 -1
- package/lib/src/shared/my-uploads/MyUploads.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +1 -1
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -1
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -1
- package/lib/src/shared/template-settings/store/template-settings-store.d.ts +2 -0
- package/lib/src/shared/template-settings/store/template-settings-store.js +72 -24
- package/lib/src/shared/unsplash-library/UnsplashLibrary.mixin.d.ts +1 -1
- package/lib/src/utils/minify-brand-page-metadata.js +1 -4
- package/package.json +15 -17
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +9 -7
- package/src/brand-page/components/cookie-consent/CookieConsent.vue +1 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +8 -3
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +5 -1
- package/src/brand-page/components/page-footer/PageFooter.mixin.ts +4 -1
- package/src/brand-page/components/page-footer/PageFooter.vue +1 -1
- package/src/brand-page/components/payment/Payment.mixin.ts +4 -3
- package/src/brand-page/components/payment/request-payment/RequestPayment.mixin.ts +8 -1
- package/src/brand-page/components/payment/request-payment/RequestPayment.vue +1 -1
- package/src/brand-page/components/save-contact/SaveContactWidget.vue +2 -1
- package/src/brand-page/components/shop/Shop.vue +6 -3
- package/src/brand-page/components/social-links/SocialLinks.vue +5 -2
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +6 -17
- package/src/brand-page/composables/consent.composable.ts +18 -4
- package/src/brand-page/models/brand-page-context.model.ts +7 -0
- package/src/brand-page/models/index.ts +26 -35
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/context.util.test.ts +43 -0
- package/src/brand-page/utils/context.util.ts +10 -0
- package/src/brand-page/utils/migration.util.ts +0 -12
- package/src/brand-page/utils/style.util.test.ts +0 -51
- package/src/brand-page/utils/text.util.ts +4 -83
- package/src/brand-page/utils/vcard.util.ts +4 -6
- package/src/brand-page/utils/view-model.util.ts +26 -94
- package/src/brand-page/view-models.ts +2 -3
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +4 -5
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.test.ts +135 -0
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +62 -21
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +1 -0
- package/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.ts +10 -6
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontSize.ts +73 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/LineHeight.ts +85 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +111 -27
- package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +9 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +11 -3
- package/src/brand-page-maker/stores/ui/ui-store.ts +1 -1
- package/src/brand-page-maker/utils/index.ts +0 -2
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +3 -37
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +11 -66
- package/src/brand-page-maker/validators/field.validator.ts +2 -10
- package/src/clients/models.ts +3 -0
- package/src/lib.ts +1 -9
- package/src/metadata-builder/ai-metadata-executor.ts +26 -0
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +5 -2
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +4 -3
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +6 -3
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +2 -1
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +13 -19
- package/src/metadata-builder/builders/update-content-text-builder.ts +148 -0
- package/src/metadata-builder/builders/update-content-text-style-builder.ts +352 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +101 -15
- package/src/metadata-builder/metadata-executor.ts +5 -0
- package/src/metadata-builder/models.ts +3 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +27 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +53 -24
- package/src/shared/content-settings/components/GenericTextInput.mixin.ts +11 -42
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +3 -16
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.mixin.ts +4 -13
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +4 -6
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +3 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +1 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +1 -1
- package/src/shared/template-settings/store/template-settings-store.ts +93 -27
- package/src/utils/minify-brand-page-metadata.ts +1 -4
- package/lib/src/brand-page/utils/migration/migration-20.d.ts +0 -2
- package/lib/src/brand-page/utils/migration/migration-20.js +0 -66
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.d.ts +0 -22
- package/lib/src/brand-page-maker/__fixtures__/complex-rte.fixture.js +0 -22
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.d.ts +0 -14
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.js +0 -39
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.d.ts +0 -28
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.js +0 -117
- package/lib/src/brand-page-maker/utils/rte-render.util.d.ts +0 -63
- package/lib/src/brand-page-maker/utils/rte-render.util.js +0 -95
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.d.ts +0 -6
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.js +0 -156
- package/src/brand-page/utils/migration/migration-20.server.test.ts +0 -125
- package/src/brand-page/utils/migration/migration-20.test.ts +0 -72
- package/src/brand-page/utils/migration/migration-20.ts +0 -87
- package/src/brand-page/utils/text.util.test.ts +0 -106
- package/src/brand-page/utils/view-model.pageid-rte.test.ts +0 -104
- package/src/brand-page-maker/__fixtures__/complex-rte.fixture.ts +0 -23
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.test.ts +0 -52
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.ts +0 -42
- package/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.ts +0 -162
- package/src/brand-page-maker/utils/__snapshots__/rte-render-parity.test.ts.snap +0 -202
- package/src/brand-page-maker/utils/rte-features.test.ts +0 -378
- package/src/brand-page-maker/utils/rte-render-parity.test.ts +0 -164
- package/src/brand-page-maker/utils/rte-render.util.ts +0 -165
- package/src/brand-page-maker/utils/rte-sanitize-json.test.ts +0 -172
- package/src/brand-page-maker/utils/rte-sanitize.util.ts +0 -192
- package/src/brand-page-maker/validators/field.validator.test.ts +0 -55
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`BP-5787 RTE render parity (golden master) > T1 — editor renders the complex fixture to the frozen HTML baseline > editor-normalized-html 1`] = `"<h2 style="text-align: center;"><span style="color: var(--logo-text-color);">Themed heading</span></h2><p><strong>bold</strong> <em>italic</em> <u>underline</u> <s>strike</s> <span style="font-family: Montserrat; font-size: 1.5em; letter-spacing: 0.05em; line-height: 1.4;">styled span</span> <mark data-color="#ffe08a" style="background-color: rgb(255, 224, 138); color: inherit;">highlight</mark> <span style="color: rgb(255, 0, 0);">literal hex</span> <a href="/about">internal link</a> <a target="_blank" rel="noopener noreferrer" href="https://example.com">external link</a></p><p style="text-align: right;">second paragraph, right-aligned</p>"`;
|
|
4
|
-
|
|
5
|
-
exports[`BP-5787 RTE render parity (golden master) > T1 — render-from-JSON (DOM-less renderer) produces equivalent HTML > serializer-html 1`] = `"<h2 style="text-align: center"><span style="color: var(--logo-text-color)">Themed heading</span></h2><p><strong>bold</strong> <em>italic</em> <u>underline</u> <s>strike</s> <span style="font-family: Montserrat; font-size: 1.5em; letter-spacing: 0.05em; line-height: 1.4">styled span</span> <mark data-color="#ffe08a" style="background-color: #ffe08a; color: inherit">highlight</mark> <span style="color: #FF0000">literal hex</span> <a href="/about">internal link</a> <a target="_blank" rel="noopener noreferrer" href="https://example.com">external link</a></p><p style="text-align: right">second paragraph, right-aligned</p>"`;
|
|
6
|
-
|
|
7
|
-
exports[`BP-5787 RTE render parity (golden master) > T6 — freezes the RAW editor JSON (pre-sanitise; not the persisted form) > editor-json 1`] = `
|
|
8
|
-
{
|
|
9
|
-
"content": [
|
|
10
|
-
{
|
|
11
|
-
"attrs": {
|
|
12
|
-
"level": 2,
|
|
13
|
-
"textAlign": "center",
|
|
14
|
-
},
|
|
15
|
-
"content": [
|
|
16
|
-
{
|
|
17
|
-
"marks": [
|
|
18
|
-
{
|
|
19
|
-
"attrs": {
|
|
20
|
-
"color": "var(--logo-text-color)",
|
|
21
|
-
"fontFamily": "",
|
|
22
|
-
"fontSize": "",
|
|
23
|
-
"letterSpacing": "",
|
|
24
|
-
"lineHeight": "",
|
|
25
|
-
},
|
|
26
|
-
"type": "textStyle",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
"text": "Themed heading",
|
|
30
|
-
"type": "text",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
"type": "heading",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"attrs": {
|
|
37
|
-
"textAlign": null,
|
|
38
|
-
},
|
|
39
|
-
"content": [
|
|
40
|
-
{
|
|
41
|
-
"marks": [
|
|
42
|
-
{
|
|
43
|
-
"type": "bold",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
"text": "bold",
|
|
47
|
-
"type": "text",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"text": " ",
|
|
51
|
-
"type": "text",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"marks": [
|
|
55
|
-
{
|
|
56
|
-
"type": "italic",
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
"text": "italic",
|
|
60
|
-
"type": "text",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"text": " ",
|
|
64
|
-
"type": "text",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"marks": [
|
|
68
|
-
{
|
|
69
|
-
"type": "underline",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
"text": "underline",
|
|
73
|
-
"type": "text",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"text": " ",
|
|
77
|
-
"type": "text",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"marks": [
|
|
81
|
-
{
|
|
82
|
-
"type": "strike",
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
"text": "strike",
|
|
86
|
-
"type": "text",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"text": " ",
|
|
90
|
-
"type": "text",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"marks": [
|
|
94
|
-
{
|
|
95
|
-
"attrs": {
|
|
96
|
-
"color": "",
|
|
97
|
-
"fontFamily": "Montserrat",
|
|
98
|
-
"fontSize": "1.5em",
|
|
99
|
-
"letterSpacing": "0.05em",
|
|
100
|
-
"lineHeight": "1.4",
|
|
101
|
-
},
|
|
102
|
-
"type": "textStyle",
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
"text": "styled span",
|
|
106
|
-
"type": "text",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"text": " ",
|
|
110
|
-
"type": "text",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"marks": [
|
|
114
|
-
{
|
|
115
|
-
"attrs": {
|
|
116
|
-
"color": "#ffe08a",
|
|
117
|
-
},
|
|
118
|
-
"type": "highlight",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
"text": "highlight",
|
|
122
|
-
"type": "text",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"text": " ",
|
|
126
|
-
"type": "text",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"marks": [
|
|
130
|
-
{
|
|
131
|
-
"attrs": {
|
|
132
|
-
"color": "#FF0000",
|
|
133
|
-
"fontFamily": "",
|
|
134
|
-
"fontSize": "",
|
|
135
|
-
"letterSpacing": "",
|
|
136
|
-
"lineHeight": "",
|
|
137
|
-
},
|
|
138
|
-
"type": "textStyle",
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
"text": "literal hex",
|
|
142
|
-
"type": "text",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"text": " ",
|
|
146
|
-
"type": "text",
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"marks": [
|
|
150
|
-
{
|
|
151
|
-
"attrs": {
|
|
152
|
-
"class": null,
|
|
153
|
-
"href": "/about",
|
|
154
|
-
"rel": null,
|
|
155
|
-
"target": "_self",
|
|
156
|
-
"title": null,
|
|
157
|
-
},
|
|
158
|
-
"type": "link",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
"text": "internal link",
|
|
162
|
-
"type": "text",
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"text": " ",
|
|
166
|
-
"type": "text",
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"marks": [
|
|
170
|
-
{
|
|
171
|
-
"attrs": {
|
|
172
|
-
"class": null,
|
|
173
|
-
"href": "https://example.com",
|
|
174
|
-
"rel": "noopener noreferrer nofollow",
|
|
175
|
-
"target": "_blank",
|
|
176
|
-
"title": null,
|
|
177
|
-
},
|
|
178
|
-
"type": "link",
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
"text": "external link",
|
|
182
|
-
"type": "text",
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
"type": "paragraph",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"attrs": {
|
|
189
|
-
"textAlign": "right",
|
|
190
|
-
},
|
|
191
|
-
"content": [
|
|
192
|
-
{
|
|
193
|
-
"text": "second paragraph, right-aligned",
|
|
194
|
-
"type": "text",
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
"type": "paragraph",
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
"type": "doc",
|
|
201
|
-
}
|
|
202
|
-
`;
|
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import { Editor } from '@tiptap/vue-3';
|
|
3
|
-
import { getRteExtensions } from '../composables/rich-text-editor/getRteExtensions';
|
|
4
|
-
import { toRteJson, renderRteToHtml } from './rte-render.util';
|
|
5
|
-
import { sanitizeRteJson } from './rte-sanitize.util';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* BP-5787 — feature-by-feature coverage of the whole RTE JSON pipeline.
|
|
9
|
-
*
|
|
10
|
-
* Each case runs a piece of authored HTML through the exact production path:
|
|
11
|
-
* HTML → toRteJson (headless editor parse) → sanitizeRteJson → renderRteToHtml
|
|
12
|
-
* (DOM-less serialiser)
|
|
13
|
-
* and asserts the feature survives end-to-end. One combined golden-master lives
|
|
14
|
-
* in rte-render-parity.test.ts; this file isolates every feature so a
|
|
15
|
-
* regression in any single one (a mark, a textStyle attr, a link, alignment, a
|
|
16
|
-
* block node) fails on its own line instead of inside one opaque snapshot.
|
|
17
|
-
*/
|
|
18
|
-
const pipe = (html: string): string => {
|
|
19
|
-
const json = toRteJson(html);
|
|
20
|
-
|
|
21
|
-
return renderRteToHtml(sanitizeRteJson(json));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe('RTE features — inline marks', () => {
|
|
25
|
-
it('bold → <strong>', () => {
|
|
26
|
-
expect(pipe('<p><strong>x</strong></p>')).toContain('<strong>x</strong>');
|
|
27
|
-
});
|
|
28
|
-
it('italic → <em>', () => {
|
|
29
|
-
expect(pipe('<p><em>x</em></p>')).toContain('<em>x</em>');
|
|
30
|
-
});
|
|
31
|
-
it('underline → <u>', () => {
|
|
32
|
-
expect(pipe('<p><u>x</u></p>')).toContain('<u>x</u>');
|
|
33
|
-
});
|
|
34
|
-
it('strikethrough → <s>', () => {
|
|
35
|
-
expect(pipe('<p><s>x</s></p>')).toContain('<s>x</s>');
|
|
36
|
-
});
|
|
37
|
-
it('inline code → <code>', () => {
|
|
38
|
-
expect(pipe('<p><code>x</code></p>')).toContain('<code>x</code>');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('RTE features — mark nesting (decoration must inherit font-size)', () => {
|
|
43
|
-
// BP-5787 regression: the textStyle <span> that carries font-size must render
|
|
44
|
-
// OUTSIDE <u>/<s>, so the decoration marks inherit the applied size. Otherwise
|
|
45
|
-
// text-decoration thickness AND vertical position are computed from the base
|
|
46
|
-
// paragraph font, giving thin, mis-centred lines on large text (v3 default
|
|
47
|
-
// priority regression vs v2). Guarded by TextStyle priority: 99.
|
|
48
|
-
it('font-size <span> wraps <u> (not the reverse)', () => {
|
|
49
|
-
const out = pipe('<p><span style="font-size: 40px"><u>x</u></span></p>');
|
|
50
|
-
|
|
51
|
-
expect(out).toContain('<span style="font-size: 40px"><u>x</u></span>');
|
|
52
|
-
expect(out).not.toMatch(/<u><span/);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('font-size <span> wraps <s> (not the reverse)', () => {
|
|
56
|
-
const out = pipe('<p><span style="font-size: 40px"><s>x</s></span></p>');
|
|
57
|
-
|
|
58
|
-
expect(out).toContain('<span style="font-size: 40px"><s>x</s></span>');
|
|
59
|
-
expect(out).not.toMatch(/<s><span/);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe('RTE features — textStyle attrs (colour/font/spacing)', () => {
|
|
64
|
-
it('rgb colour is preserved', () => {
|
|
65
|
-
expect(
|
|
66
|
-
pipe('<p><span style="color: rgb(255, 0, 0)">x</span></p>'),
|
|
67
|
-
).toContain('color: rgb(255, 0, 0)');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('hex colour is preserved verbatim (Tiptap v3 no longer normalises to rgb)', () => {
|
|
71
|
-
expect(pipe('<p><span style="color: #00ff00">x</span></p>')).toContain(
|
|
72
|
-
'color: #00ff00',
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('theme token var(--…) colour survives verbatim (NOT flattened to rgb)', () => {
|
|
77
|
-
const out = pipe(
|
|
78
|
-
'<p><span style="color: var(--logo-text-color)">x</span></p>',
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
expect(out).toContain('color: var(--logo-text-color)');
|
|
82
|
-
expect(out).not.toContain('rgb(');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('single-word font-family is preserved', () => {
|
|
86
|
-
expect(
|
|
87
|
-
pipe('<p><span style="font-family: Montserrat">x</span></p>'),
|
|
88
|
-
).toContain('font-family: Montserrat');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('multi-word font-family is preserved UNQUOTED (BP-5787 quote-strip)', () => {
|
|
92
|
-
const out = pipe('<p><span style="font-family: Open Sans">x</span></p>');
|
|
93
|
-
|
|
94
|
-
expect(out).toContain('font-family: Open Sans');
|
|
95
|
-
// must not carry the CSS quotes that the sanitiser would otherwise drop
|
|
96
|
-
expect(out).not.toContain('font-family: "Open Sans"');
|
|
97
|
-
expect(out).not.toContain('"');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('font-size / letter-spacing / line-height are preserved', () => {
|
|
101
|
-
expect(pipe('<p><span style="font-size: 2em">x</span></p>')).toContain(
|
|
102
|
-
'font-size: 2em',
|
|
103
|
-
);
|
|
104
|
-
expect(
|
|
105
|
-
pipe('<p><span style="letter-spacing: 0.1em">x</span></p>'),
|
|
106
|
-
).toContain('letter-spacing: 0.1em');
|
|
107
|
-
expect(pipe('<p><span style="line-height: 1.5">x</span></p>')).toContain(
|
|
108
|
-
'line-height: 1.5',
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('RTE features — background colour (highlight)', () => {
|
|
114
|
-
it('highlight → <mark> with data-color + background-color + color:inherit', () => {
|
|
115
|
-
const out = pipe(
|
|
116
|
-
'<p><mark data-color="#ffe08a" style="background-color: #ffe08a">x</mark></p>',
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
expect(out).toContain(
|
|
120
|
-
'<mark data-color="#ffe08a" style="background-color: #ffe08a; color: inherit">x</mark>',
|
|
121
|
-
);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('theme token background colour survives verbatim', () => {
|
|
125
|
-
const out = pipe(
|
|
126
|
-
'<p><mark data-color="var(--logo-primary-color)" style="background-color: var(--logo-primary-color)">x</mark></p>',
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
expect(out).toContain('background-color: var(--logo-primary-color)');
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('RTE features — hyperlinks', () => {
|
|
134
|
-
it('external link keeps href + target + rel', () => {
|
|
135
|
-
const out = pipe(
|
|
136
|
-
'<p><a target="_blank" rel="noopener noreferrer" href="https://example.com">x</a></p>',
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
expect(out).toContain('href="https://example.com"');
|
|
140
|
-
expect(out).toContain('target="_blank"');
|
|
141
|
-
expect(out).toContain('rel="noopener noreferrer"');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('freshly authored external link (no target/rel in source) still renders target + rel', () => {
|
|
145
|
-
// Regression: target/rel are derived at render time from the href, so a link
|
|
146
|
-
// authored as a bare <a href> — the normal editor case — must still open in a
|
|
147
|
-
// new tab with noopener. Before the render-time policy, these were injected by
|
|
148
|
-
// the HTML DOMPurify sanitiser and were lost when storage moved to JSON.
|
|
149
|
-
const out = pipe('<p><a href="https://example.com">x</a></p>');
|
|
150
|
-
|
|
151
|
-
expect(out).toContain('href="https://example.com"');
|
|
152
|
-
expect(out).toContain('target="_blank"');
|
|
153
|
-
expect(out).toContain('rel="noopener noreferrer"');
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('external link with a stale target is normalised to _blank', () => {
|
|
157
|
-
const out = pipe(
|
|
158
|
-
'<p><a target="_self" href="https://example.com">x</a></p>',
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
expect(out).toContain('target="_blank"');
|
|
162
|
-
expect(out).not.toContain('target="_self"');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('internal relative link keeps its href and gets no target/rel', () => {
|
|
166
|
-
const out = pipe('<p><a href="/about">x</a></p>');
|
|
167
|
-
|
|
168
|
-
expect(out).toContain('href="/about"');
|
|
169
|
-
expect(out).not.toContain('target=');
|
|
170
|
-
expect(out).not.toContain('rel=');
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('internal page reference (pageid:) survives the sanitiser with no target/rel', () => {
|
|
174
|
-
// pageid: hrefs are resolved to real routes later in the view-model
|
|
175
|
-
// transform; the sanitiser must not strip them, and they are not external so
|
|
176
|
-
// they get no target/rel.
|
|
177
|
-
const out = pipe('<p><a href="pageid:abc-123">x</a></p>');
|
|
178
|
-
|
|
179
|
-
expect(out).toContain('href="pageid:abc-123"');
|
|
180
|
-
expect(out).not.toContain('target=');
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('javascript: link is dropped (mark removed, text kept)', () => {
|
|
184
|
-
const out = pipe('<p><a href="javascript:alert(1)">x</a></p>');
|
|
185
|
-
|
|
186
|
-
expect(out).not.toContain('<a');
|
|
187
|
-
expect(out).not.toContain('javascript:');
|
|
188
|
-
expect(out).toContain('x');
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('data: link is dropped', () => {
|
|
192
|
-
const out = pipe(
|
|
193
|
-
'<p><a href="data:text/html,<script>1</script>">x</a></p>',
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
expect(out).not.toContain('<a');
|
|
197
|
-
expect(out).not.toContain('data:');
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
describe('RTE features — text alignment', () => {
|
|
202
|
-
for (const align of ['center', 'right', 'justify', 'left'] as const) {
|
|
203
|
-
it(`paragraph text-align: ${align}`, () => {
|
|
204
|
-
expect(pipe(`<p style="text-align: ${align}">x</p>`)).toContain(
|
|
205
|
-
`<p style="text-align: ${align}">`,
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
it('heading carries its alignment', () => {
|
|
211
|
-
expect(pipe('<h2 style="text-align: center">x</h2>')).toContain(
|
|
212
|
-
'<h2 style="text-align: center">',
|
|
213
|
-
);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe('RTE features — block nodes', () => {
|
|
218
|
-
it('headings h1–h6', () => {
|
|
219
|
-
for (const level of [1, 2, 3, 4, 5, 6]) {
|
|
220
|
-
expect(pipe(`<h${level}>x</h${level}>`)).toContain(`<h${level}`);
|
|
221
|
-
expect(pipe(`<h${level}>x</h${level}>`)).toContain(`</h${level}>`);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it('bullet list → <ul><li>', () => {
|
|
226
|
-
const out = pipe('<ul><li>a</li><li>b</li></ul>');
|
|
227
|
-
|
|
228
|
-
expect(out).toContain('<ul>');
|
|
229
|
-
expect(out).toContain('<li>');
|
|
230
|
-
expect(out).toContain('a');
|
|
231
|
-
expect(out).toContain('b');
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it('ordered list → <ol><li>', () => {
|
|
235
|
-
expect(pipe('<ol><li>a</li></ol>')).toContain('<ol>');
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it('blockquote → <blockquote>', () => {
|
|
239
|
-
expect(pipe('<blockquote><p>q</p></blockquote>')).toContain('<blockquote>');
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('code block → <pre><code>', () => {
|
|
243
|
-
expect(pipe('<pre><code>c</code></pre>')).toContain('<pre><code>');
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('hard break → <br/>', () => {
|
|
247
|
-
expect(pipe('<p>a<br>b</p>')).toContain('<br/>');
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
it('horizontal rule → <hr/>', () => {
|
|
251
|
-
expect(pipe('<p>a</p><hr><p>b</p>')).toContain('<hr/>');
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
describe('RTE features — combinations & escaping', () => {
|
|
256
|
-
it('nested marks (colour + bold + italic) all survive on the same run', () => {
|
|
257
|
-
const out = pipe(
|
|
258
|
-
'<p><span style="color: rgb(1, 2, 3)"><strong><em>x</em></strong></span></p>',
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
expect(out).toContain('color: rgb(1, 2, 3)');
|
|
262
|
-
expect(out).toContain('<strong>');
|
|
263
|
-
expect(out).toContain('<em>');
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it('a styled hyperlink keeps both the colour and the link', () => {
|
|
267
|
-
const out = pipe(
|
|
268
|
-
'<p><a href="https://x.com"><span style="color: rgb(0, 151, 215)">x</span></a></p>',
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
expect(out).toContain('href="https://x.com"');
|
|
272
|
-
expect(out).toContain('color: rgb(0, 151, 215)');
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('HTML-special characters in text are escaped', () => {
|
|
276
|
-
const out = pipe('<p>a <b> & "c"</p>');
|
|
277
|
-
|
|
278
|
-
expect(out).toContain('<b>');
|
|
279
|
-
expect(out).toContain('&');
|
|
280
|
-
expect(out).not.toContain('<b>');
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it('serialisation is idempotent (serialize(json) === serialize(reparse))', () => {
|
|
284
|
-
const html =
|
|
285
|
-
'<h2 style="text-align: center"><span style="color: var(--logo-text-color); font-family: Open Sans; font-size: 1.5em">Heading</span></h2>' +
|
|
286
|
-
'<p><strong>bold</strong> <em>italic</em> <u>u</u> <s>s</s> ' +
|
|
287
|
-
'<mark data-color="#ffe08a" style="background-color: #ffe08a">hl</mark> ' +
|
|
288
|
-
'<a target="_blank" rel="noopener noreferrer" href="https://x.com">link</a></p>';
|
|
289
|
-
const once = pipe(html);
|
|
290
|
-
const twice = renderRteToHtml(sanitizeRteJson(toRteJson(once)));
|
|
291
|
-
|
|
292
|
-
expect(twice).toEqual(once);
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
describe('RTE features — maker toolbar commands (emit path)', () => {
|
|
297
|
-
let editors: Editor[] = [];
|
|
298
|
-
|
|
299
|
-
afterEach(() => {
|
|
300
|
-
editors.forEach((e) => e.destroy());
|
|
301
|
-
editors = [];
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// Apply a real editor command to a full selection (as the toolbar does),
|
|
305
|
-
// then run the emitted JSON through sanitise + serialise.
|
|
306
|
-
const applied = (fn: (e: Editor) => void): string => {
|
|
307
|
-
const editor = new Editor({
|
|
308
|
-
extensions: getRteExtensions({ restrictStarterKit: true }),
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
editors.push(editor);
|
|
312
|
-
editor.commands.setContent('<p>styled text</p>');
|
|
313
|
-
editor.commands.selectAll();
|
|
314
|
-
fn(editor);
|
|
315
|
-
|
|
316
|
-
return renderRteToHtml(sanitizeRteJson(editor.getJSON()));
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
it('setColor', () => {
|
|
320
|
-
expect(applied((e) => e.commands.setColor('rgb(255, 0, 0)'))).toContain(
|
|
321
|
-
'color: rgb(255, 0, 0)',
|
|
322
|
-
);
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
it('setHighlight (background colour)', () => {
|
|
326
|
-
const out = applied((e) => e.commands.setHighlight({ color: '#ffe08a' }));
|
|
327
|
-
|
|
328
|
-
expect(out).toContain('background-color: #ffe08a');
|
|
329
|
-
expect(out).toContain('<mark');
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('toggleBold / toggleItalic / toggleUnderline / toggleStrike', () => {
|
|
333
|
-
expect(applied((e) => e.commands.toggleBold())).toContain('<strong>');
|
|
334
|
-
expect(applied((e) => e.commands.toggleItalic())).toContain('<em>');
|
|
335
|
-
expect(applied((e) => e.commands.toggleUnderline())).toContain('<u>');
|
|
336
|
-
expect(applied((e) => e.commands.toggleStrike())).toContain('<s>');
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
it('setFontFamily (multi-word, unquoted)', () => {
|
|
340
|
-
const out = applied((e) =>
|
|
341
|
-
(e.commands as { setFontFamily: (f: string) => boolean }).setFontFamily(
|
|
342
|
-
'Open Sans',
|
|
343
|
-
),
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
expect(out).toContain('font-family: Open Sans');
|
|
347
|
-
expect(out).not.toContain('"');
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it('setFontSize / setLetterSpacing', () => {
|
|
351
|
-
expect(
|
|
352
|
-
applied((e) =>
|
|
353
|
-
(e.commands as { setFontSize: (v: string) => boolean }).setFontSize(
|
|
354
|
-
'2em',
|
|
355
|
-
),
|
|
356
|
-
),
|
|
357
|
-
).toContain('font-size: 2em');
|
|
358
|
-
expect(
|
|
359
|
-
applied((e) =>
|
|
360
|
-
(
|
|
361
|
-
e.commands as { setLetterSpacing: (v: string) => boolean }
|
|
362
|
-
).setLetterSpacing('0.1em'),
|
|
363
|
-
),
|
|
364
|
-
).toContain('letter-spacing: 0.1em');
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
it('setTextAlign', () => {
|
|
368
|
-
expect(applied((e) => e.commands.setTextAlign('center'))).toContain(
|
|
369
|
-
'text-align: center',
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it('setLink keeps the href through the pipeline', () => {
|
|
374
|
-
expect(
|
|
375
|
-
applied((e) => e.commands.setLink({ href: 'https://x.com' })),
|
|
376
|
-
).toContain('href="https://x.com"');
|
|
377
|
-
});
|
|
378
|
-
});
|