Skip to content

Commit

Permalink
test(nonlocalizedblocks): add fixture and tests (#244)
Browse files Browse the repository at this point in the history
* test(nonlocalizedblocks): fixture and initial tests

* test(nonlocalizedblocks): include translation test
  • Loading branch information
thompsonsj authored Jan 13, 2025
1 parent 87998b8 commit 5811ed4
Show file tree
Hide file tree
Showing 4 changed files with 785 additions and 1 deletion.
138 changes: 137 additions & 1 deletion dev/src/app/(payload)/admin/importMap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dev/src/collections/fields/lexicalEditorWithBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ export const lexicalEditorWithBlocks: RichTextField = {
relationTo: "media",
}
],
},
{
slug: "cookieTable",
fields: [
{
name: "cookieCategoryId",
type: "select",
options: [
'strictlyNecessary',
'functional',
'performance',
'tracking',
]
}
],
}
],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { Policy } from "@/payload-types";

export const fixture = {
"root": {
"children": [
{
"children": [
{
"detail": 0,
"format": 0,
"mode": "normal",
"style": "",
"text": "What happens if a block doesn't have any localized fields?",
"type": "text",
"version": 1
}
],
"direction": "ltr",
"format": "",
"indent": 0,
"type": "paragraph",
"version": 1,
"textFormat": 0,
"textStyle": ""
},
{
"format": "",
"type": "block",
"version": 2,
"fields": {
"id": "678564c06ec4a6f1fcf6a623",
"blockName": "",
"cookieCategoryId": "strictlyNecessary",
"blockType": "cookieTable"
}
},
{
"children": [
{
"detail": 0,
"format": 0,
"mode": "normal",
"style": "",
"text": "For example - a block that only contains a select field, which is included twice for good measure!",
"type": "text",
"version": 1
}
],
"direction": "ltr",
"format": "",
"indent": 0,
"type": "paragraph",
"version": 1,
"textFormat": 0,
"textStyle": ""
},
{
"format": "",
"type": "block",
"version": 2,
"fields": {
"id": "678564926ec4a6f1fcf6a622",
"blockName": "",
"cookieCategoryId": "functional",
"blockType": "cookieTable"
}
}
],
"direction": "ltr",
"format": "",
"indent": 0,
"type": "root",
"version": 1
}
} as Policy['content']
Loading

0 comments on commit 5811ed4

Please sign in to comment.