Socket
Socket
Sign inDemoInstall

@contentful/contentful-slatejs-adapter

Package Overview
Dependencies
1
Maintainers
163
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 15.16.3 to 15.16.4

146

dist/lib/__test__/contentful-to-slatejs-adapter.test.js

@@ -17,2 +17,63 @@ var _a;

});
it('converts Contentful mentions to Slate mentions', function () {
var contentfulInput = {
content: [
{
content: [
{ data: {}, marks: [], nodeType: 'text', value: 'Hello ' },
{
content: [{ data: {}, marks: [], nodeType: 'text', value: '' }],
data: { target: { sys: { id: 'user-id-0', linkType: 'User', type: 'Link' } } },
nodeType: 'mention',
},
{ data: {}, marks: [], nodeType: 'text', value: '' },
],
data: {},
nodeType: 'paragraph',
},
],
data: {},
nodeType: 'document',
};
var slateOutput = toSlatejsDocument({
document: contentfulInput,
});
var expectedSlateOutput = [
{
type: 'paragraph',
isVoid: false,
data: {},
children: [
{
data: {},
text: 'Hello ',
},
{
type: 'mention',
isVoid: false,
data: {
target: {
sys: {
type: 'Link',
linkType: 'User',
id: 'user-id-0',
},
},
},
children: [
{
data: {},
text: '',
},
],
},
{
data: {},
text: '',
},
],
},
];
expect(slateOutput).toStrictEqual(expectedSlateOutput);
});
});

@@ -27,2 +88,87 @@ describe('toContentfulDocument()', function () {

});
it('is converts Slate mentions to Contentful mentions', function () {
var slateFormatWithMention = [
{
type: 'paragraph',
data: {},
children: [
{
text: 'Hello ',
},
{
type: 'mention',
data: {
target: {
sys: {
type: 'Link',
linkType: 'User',
id: 'user-id-0',
},
},
},
children: [
{
text: '',
},
],
},
{
text: '',
},
],
},
];
var resultContentfulDoc = toContentfulDocument({
document: slateFormatWithMention,
schema: schema,
});
var expectedContentfulDoc = {
content: [
{
content: [
{ data: {}, marks: [], nodeType: 'text', value: 'Hello ' },
{
content: [{ data: {}, marks: [], nodeType: 'text', value: '' }],
data: { target: { sys: { id: 'user-id-0', linkType: 'User', type: 'Link' } } },
nodeType: 'mention',
},
{ data: {}, marks: [], nodeType: 'text', value: '' },
],
data: {},
nodeType: 'paragraph',
},
],
data: {},
nodeType: 'document',
};
expect(resultContentfulDoc).toEqual(expectedContentfulDoc);
});
it('converts text-only nodes', function () {
var slateText = [
{
type: 'paragraph',
data: {},
children: [
{
text: 'Hello ',
},
],
},
];
var convertedToContentful = toContentfulDocument({
document: slateText,
});
var expectedContentfulDoc = {
content: [
{
content: [{ data: {}, marks: [], nodeType: 'text', value: 'Hello ' }],
data: {},
nodeType: 'paragraph',
},
],
data: {},
nodeType: 'document',
};
expect(convertedToContentful).toStrictEqual(expectedContentfulDoc);
});
});

@@ -29,0 +175,0 @@ };

6

package.json
{
"name": "@contentful/contentful-slatejs-adapter",
"version": "15.16.3",
"version": "15.16.4",
"description": "",
"keywords": [],
"main": "dist/contentful-slatejs-adapter.es5.js",
"typings": "dist/types/contentful-slatejs-adapter.d.ts",
"typings": "dist/types/index.d.ts",
"files": [

@@ -61,3 +61,3 @@ "dist"

},
"gitHead": "47f96df347c73ac301cbcb39dea23dc9236d46c6"
"gitHead": "e7ef39edac43e6c78fb914de4f9b82905d64c6ec"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc