Skip to content

Commit

Permalink
test(block-tools): add tests for gdocs pre-processsing
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Oct 23, 2023
1 parent f30b869 commit 45683f1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {BlockTestFn} from '../types'
import defaultSchema from '../../../fixtures/defaultSchema'

const blockContentType = defaultSchema
.get('blogPost')
.fields.find((field: any) => field.name === 'body').type

const testFn: BlockTestFn = (html, blockTools, commonOptions) => {
return blockTools.htmlToBlocks(html, blockContentType, commonOptions)
}

export default testFn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<!--StartFragment--><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-21a47c78-7fff-15da-47f1-302ae3839dbc"><h1 dir="ltr" style="line-height:1.2;margin-right: -1.5pt;margin-top:16pt;margin-bottom:0pt;"><span style="font-size:13.999999999999998pt;font-family:'Playfair Display',serif;color:#f75d5d;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Skills</span></h1><p dir="ltr" style="line-height:1.56;margin-top:10pt;margin-bottom:0pt;"><span style="font-size:10pt;font-family:Lato,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ac interdum nisi. Sed in consequat mi. Sed pulvinar lacinia felis eu finibus.</span></p></b><br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"_key": "randomKey0",
"_type": "block",
"children": [{"_key": "randomKey00", "_type": "span", "marks": ["strong"], "text": "Skills"}],
"markDefs": [],
"style": "h1"
},
{
"_key": "randomKey1",
"_type": "block",
"children": [
{
"_key": "randomKey10",
"_type": "span",
"marks": [],
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ac interdum nisi. Sed in consequat mi. Sed pulvinar lacinia felis eu finibus."
}
],
"markDefs": [],
"style": "normal"
},
{
"_key": "randomKey2",
"_type": "block",
"children": [{"_key": "randomKey20", "_type": "span", "marks": [], "text": "\n"}],
"markDefs": [],
"style": "normal"
}
]

2 comments on commit 45683f1

@vercel
Copy link

@vercel vercel bot commented on 45683f1 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio-git-next.sanity.build
performance-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 45683f1 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.