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', () => {
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);
expect(result[1].content).not.toMatch(/ data-tomark-pass /);
expect(result).toHaveLength(3);
expect(result).toStrictEqual(uneditableBlockTokens);
});
......
......@@ -17,7 +17,7 @@ export const htmlBlockNode = {
// Token spec helpers
const buildUneditableOpenToken = type => {
const buildMockUneditableOpenToken = type => {
return {
type: 'openTag',
tagName: type,
......@@ -28,7 +28,7 @@ const buildUneditableOpenToken = type => {
};
};
const buildUneditableCloseToken = type => {
const buildMockUneditableCloseToken = type => {
return { type: 'closeTag', tagName: type };
};
......@@ -36,8 +36,8 @@ export const originToken = {
type: 'text',
content: '{:.no_toc .hidden-md .hidden-lg}',
};
export const uneditableCloseToken = buildUneditableCloseToken('div');
export const uneditableOpenTokens = [buildUneditableOpenToken('div'), originToken];
export const uneditableCloseToken = buildMockUneditableCloseToken('div');
export const uneditableOpenTokens = [buildMockUneditableOpenToken('div'), originToken];
export const uneditableCloseTokens = [originToken, uneditableCloseToken];
export const uneditableTokens = [...uneditableOpenTokens, uneditableCloseToken];
......@@ -46,17 +46,17 @@ export const originInlineToken = {
content: '<i>Inline</i> content',
};
export const uneditableInlineTokens = [
buildUneditableOpenToken('a'),
buildMockUneditableOpenToken('a'),
originInlineToken,
buildUneditableCloseToken('a'),
buildMockUneditableCloseToken('a'),
];
export const uneditableBlockTokens = [
buildUneditableOpenToken('div'),
buildMockUneditableOpenToken('div'),
{
type: 'text',
tagName: null,
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