From 577fa7ae65d167b5f0b60efd9d68dff15b87ea0d Mon Sep 17 00:00:00 2001 From: Levi Mykel Gable <9385378+levimykel@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:07:58 +0200 Subject: [PATCH] test: add tests for text in links --- test/types/customType-contentRelationship.types.ts | 14 ++++++++++++++ test/types/customType-link.types.ts | 13 +++++++++++++ test/types/customType-linkToMedia.types.ts | 14 ++++++++++++++ test/types/fields-contentRelationship.types.ts | 3 +++ test/types/fields-link.types.ts | 5 +++++ test/types/fields-linkToMedia.types.ts | 3 +++ 6 files changed, 52 insertions(+) diff --git a/test/types/customType-contentRelationship.types.ts b/test/types/customType-contentRelationship.types.ts index 2789c2be..00f51093 100644 --- a/test/types/customType-contentRelationship.types.ts +++ b/test/types/customType-contentRelationship.types.ts @@ -96,6 +96,20 @@ expectType>({ }, }) +/** + * Supports optional `text` property. + */ +expectType({ + type: prismic.CustomTypeModelFieldType.Link, + config: { + label: "string", + select: prismic.CustomTypeModelLinkSelectType.Document, + text: { + type: prismic.CustomTypeModelFieldType.Text, + }, + }, +}) + /** * `@prismicio/types` extends `@prismicio/types-internal` */ diff --git a/test/types/customType-link.types.ts b/test/types/customType-link.types.ts index a44fcd91..a6acd23d 100644 --- a/test/types/customType-link.types.ts +++ b/test/types/customType-link.types.ts @@ -60,6 +60,19 @@ expectType({ }, }) +/** + * Supports optional `text` property. + */ +expectType({ + type: prismic.CustomTypeModelFieldType.Link, + config: { + label: "string", + text: { + type: prismic.CustomTypeModelFieldType.Text, + }, + }, +}) + /** * `@prismicio/types` extends `@prismicio/types-internal` */ diff --git a/test/types/customType-linkToMedia.types.ts b/test/types/customType-linkToMedia.types.ts index dae8e2af..9553ad2b 100644 --- a/test/types/customType-linkToMedia.types.ts +++ b/test/types/customType-linkToMedia.types.ts @@ -40,6 +40,20 @@ expectType({ }, }) +/** + * Supports optional `text` property. + */ +expectType({ + type: prismic.CustomTypeModelFieldType.Link, + config: { + label: "string", + select: prismic.CustomTypeModelLinkSelectType.Media, + text: { + type: prismic.CustomTypeModelFieldType.Text, + }, + }, +}) + /** * `@prismicio/types` extends `@prismicio/types-internal` */ diff --git a/test/types/fields-contentRelationship.types.ts b/test/types/fields-contentRelationship.types.ts index 352cf78f..1b8f49c0 100644 --- a/test/types/fields-contentRelationship.types.ts +++ b/test/types/fields-contentRelationship.types.ts @@ -32,6 +32,7 @@ expectType({ slug: "string", isBroken: true, data: undefined, + text: "string", }) expectType>({ link_type: prismic.LinkType.Document, @@ -44,6 +45,7 @@ expectType>({ slug: "string", isBroken: true, data: undefined, + text: "string", }) expectType>({ link_type: prismic.LinkType.Document, @@ -57,6 +59,7 @@ expectType>({ slug: "string", isBroken: true, data: undefined, + text: "string", }) /** diff --git a/test/types/fields-link.types.ts b/test/types/fields-link.types.ts index 813eea01..65e4e019 100644 --- a/test/types/fields-link.types.ts +++ b/test/types/fields-link.types.ts @@ -41,6 +41,7 @@ expectType({ link_type: prismic.LinkType.Web, url: "string", target: "string", + text: "string", }) // Content relationship link expectType({ @@ -54,6 +55,7 @@ expectType({ slug: "string", isBroken: true, data: undefined, + text: "string", }) // Media link expectType({ @@ -64,17 +66,20 @@ expectType({ size: "string", height: "string", width: "string", + text: "string", }) expectType>({ link_type: prismic.LinkType.Web, url: "string", target: "string", + text: "string", }) expectType>({ link_type: prismic.LinkType.Web, // @ts-expect-error - Empty fields cannot contain a filled value. url: "string", target: "string", + text: "string", }) /** diff --git a/test/types/fields-linkToMedia.types.ts b/test/types/fields-linkToMedia.types.ts index 44a10d15..873b0ed4 100644 --- a/test/types/fields-linkToMedia.types.ts +++ b/test/types/fields-linkToMedia.types.ts @@ -30,6 +30,7 @@ expectType({ size: "string", height: "string", width: "string", + text: "string", }) expectType>({ id: "string", @@ -40,6 +41,7 @@ expectType>({ size: "string", height: "string", width: "string", + text: "string", }) expectType>({ link_type: prismic.LinkType.Media, @@ -51,6 +53,7 @@ expectType>({ size: "string", height: "string", width: "string", + text: "string", }) /**