Commit 795c8e55 authored by derek-knox's avatar derek-knox

Apply feedback - improved logic in spec

parent 9cf189f1
...@@ -66,6 +66,8 @@ describe('Build Uneditable Token renderer helper', () => { ...@@ -66,6 +66,8 @@ describe('Build Uneditable Token renderer helper', () => {
it('returns a 3-item array of tokens with the htmlBlockNode wrapped as a text token in the middle of block tokens', () => { it('returns a 3-item array of tokens with the htmlBlockNode wrapped as a text token in the middle of block tokens', () => {
const result = buildUneditableHtmlAsTextTokens(htmlBlockNode); const result = buildUneditableHtmlAsTextTokens(htmlBlockNode);
expect(result[1].content).not.toMatch(/ data-tomark-pass /);
expect(result).toHaveLength(3); expect(result).toHaveLength(3);
expect(result).toStrictEqual(uneditableBlockTokens); expect(result).toStrictEqual(uneditableBlockTokens);
}); });
......
...@@ -17,7 +17,7 @@ export const htmlBlockNode = { ...@@ -17,7 +17,7 @@ export const htmlBlockNode = {
// Token spec helpers // Token spec helpers
const buildUneditableOpenToken = type => { const buildMockUneditableOpenToken = type => {
return { return {
type: 'openTag', type: 'openTag',
tagName: type, tagName: type,
...@@ -28,7 +28,7 @@ const buildUneditableOpenToken = type => { ...@@ -28,7 +28,7 @@ const buildUneditableOpenToken = type => {
}; };
}; };
const buildUneditableCloseToken = type => { const buildMockUneditableCloseToken = type => {
return { type: 'closeTag', tagName: type }; return { type: 'closeTag', tagName: type };
}; };
...@@ -36,8 +36,8 @@ export const originToken = { ...@@ -36,8 +36,8 @@ export const originToken = {
type: 'text', type: 'text',
content: '{:.no_toc .hidden-md .hidden-lg}', content: '{:.no_toc .hidden-md .hidden-lg}',
}; };
export const uneditableCloseToken = buildUneditableCloseToken('div'); export const uneditableCloseToken = buildMockUneditableCloseToken('div');
export const uneditableOpenTokens = [buildUneditableOpenToken('div'), originToken]; 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];
...@@ -46,17 +46,17 @@ export const originInlineToken = { ...@@ -46,17 +46,17 @@ export const originInlineToken = {
content: '<i>Inline</i> content', content: '<i>Inline</i> content',
}; };
export const uneditableInlineTokens = [ export const uneditableInlineTokens = [
buildUneditableOpenToken('a'), buildMockUneditableOpenToken('a'),
originInlineToken, originInlineToken,
buildUneditableCloseToken('a'), buildMockUneditableCloseToken('a'),
]; ];
export const uneditableBlockTokens = [ export const uneditableBlockTokens = [
buildUneditableOpenToken('div'), buildMockUneditableOpenToken('div'),
{ {
type: 'text', type: 'text',
tagName: null, tagName: null,
content: '<div><h1>Some header</h1><p>Some paragraph</p></div>', content: '<div><h1>Some header</h1><p>Some paragraph</p></div>',
}, },
buildUneditableCloseToken('div'), buildMockUneditableCloseToken('div'),
]; ];
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