diff --git a/src/compiler/tests/ribbit.test.ts b/src/compiler/tests/ribbit.test.ts index 9651adc..e2bb6c2 100644 --- a/src/compiler/tests/ribbit.test.ts +++ b/src/compiler/tests/ribbit.test.ts @@ -39,7 +39,7 @@ const tagCall = (tagName: string, atNamed = {}, ...args: any[]) => { const space = attrs.length ? ' ' : '' const children = args .reverse() - .map(a => a === null ? buffer.pop() : a) + .map(a => a === TAG_TOKEN ? buffer.pop() : a) .reverse().join(' ') .replaceAll(` ${NOSPACE_TOKEN} `, '') @@ -50,13 +50,16 @@ const tagCall = (tagName: string, atNamed = {}, ...args: any[]) => { } const tag = async (tagName: string, atNamed = {}, ...args: any[]) => { - if (typeof args[0] === 'function') + if (typeof args[0] === 'function') { await tagBlock(tagName, atNamed, args[0]) - else + } else { tagCall(tagName, atNamed, ...args) + return TAG_TOKEN + } } const NOSPACE_TOKEN = '!!ribbit-nospace!!' +const TAG_TOKEN = '!!ribbit-tag!!' const SELF_CLOSING = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"] describe('ribbit', () => {