Commit a9ae4ef6 authored by derek-knox's avatar derek-knox

DRY mock data cleanup

parent 5cad762b
// Node spec helpers // Node spec helpers
export const buildMockTextNode = literal => { export const buildMockTextNode = literal => ({ literal, type: 'text' });
return {
firstChild: null,
literal,
type: 'text',
};
};
export const normalTextNode = buildMockTextNode('This is just normal text.'); export const normalTextNode = buildMockTextNode('This is just normal text.');
...@@ -23,17 +17,20 @@ const buildMockUneditableOpenToken = type => { ...@@ -23,17 +17,20 @@ const buildMockUneditableOpenToken = type => {
}; };
}; };
const buildMockUneditableCloseToken = type => { const buildMockTextToken = content => {
return { type: 'closeTag', tagName: type }; return {
};
export const originToken = {
type: 'text', type: 'text',
tagName: null, tagName: null,
content: '{:.no_toc .hidden-md .hidden-lg}', content,
};
}; };
const buildMockUneditableCloseToken = type => ({ type: 'closeTag', tagName: type });
export const originToken = buildMockTextToken('{:.no_toc .hidden-md .hidden-lg}');
const uneditableOpenToken = buildMockUneditableOpenToken('div');
export const uneditableOpenTokens = [uneditableOpenToken, originToken];
export const uneditableCloseToken = buildMockUneditableCloseToken('div'); export const uneditableCloseToken = buildMockUneditableCloseToken('div');
export const uneditableOpenTokens = [buildMockUneditableOpenToken('div'), originToken];
export const uneditableCloseTokens = [originToken, uneditableCloseToken]; export const uneditableCloseTokens = [originToken, uneditableCloseToken];
export const uneditableTokens = [...uneditableOpenTokens, uneditableCloseToken]; export const uneditableTokens = [...uneditableOpenTokens, uneditableCloseToken];
...@@ -41,6 +38,7 @@ export const originInlineToken = { ...@@ -41,6 +38,7 @@ export const originInlineToken = {
type: 'text', type: 'text',
content: '<i>Inline</i> content', content: '<i>Inline</i> content',
}; };
export const uneditableInlineTokens = [ export const uneditableInlineTokens = [
buildMockUneditableOpenToken('a'), buildMockUneditableOpenToken('a'),
originInlineToken, originInlineToken,
...@@ -48,13 +46,9 @@ export const uneditableInlineTokens = [ ...@@ -48,13 +46,9 @@ export const uneditableInlineTokens = [
]; ];
export const uneditableBlockTokens = [ export const uneditableBlockTokens = [
buildMockUneditableOpenToken('div'), uneditableOpenToken,
{ buildMockTextToken('<div><h1>Some header</h1><p>Some paragraph</p></div>'),
type: 'text', uneditableCloseToken,
tagName: null,
content: '<div><h1>Some header</h1><p>Some paragraph</p></div>',
},
buildMockUneditableCloseToken('div'),
]; ];
export const attributeDefinition = '{:.no_toc .hidden-md .hidden-lg}'; export const attributeDefinition = '{:.no_toc .hidden-md .hidden-lg}';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment