diff --git a/.eslintrc b/.eslintrc index d603c3b..9dd49d6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -108,16 +108,11 @@ rules: prefer-spread: 2 max-len: [2, 260] no-template-curly-in-string: 2 + generator-star-spacing: [2, both] + object-shorthand: [2, always] + arrow-parens: [2, as-needed] react/jsx-uses-react: 2 react/jsx-uses-vars: 2 - # disable builtin rules that are incompatible with Babel plugin ones - generator-star-spacing: 0 - object-shorthand: 0 - arrow-parens: 0 - - babel/generator-star-spacing: [2, both] - babel/object-shorthand: [2, always] - babel/arrow-parens: [2, as-needed] babel/no-await-in-loop: 2 diff --git a/.gitignore b/.gitignore index a388591..cab03c3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules coverage build /serializer.js +npm-debug.log diff --git a/src/render.js b/src/render.js index 8123d52..6c169a9 100644 --- a/src/render.js +++ b/src/render.js @@ -3,7 +3,9 @@ import compact from 'lodash.compact'; const renderChildToJson = child => { if(!child) return null; - if(child.type === 'tag') { + if(child.type === 'root') { + return renderChildToJson(child.children[0]); + } else if(child.type === 'tag') { return { type: child.name, props: child.attribs, @@ -15,4 +17,4 @@ const renderChildToJson = child => { } }; -export default wrapper => renderChildToJson(wrapper.children()[0]); +export default wrapper => renderChildToJson(wrapper[0]); diff --git a/tests/core/__snapshots__/render.test.js.snap b/tests/core/__snapshots__/render.test.js.snap index 5d53b4e..b97d1d4 100644 --- a/tests/core/__snapshots__/render.test.js.snap +++ b/tests/core/__snapshots__/render.test.js.snap @@ -32,4 +32,15 @@ exports[`test converts basic pure render 1`] = ` `; +exports[`test renders the whole list 1`] = ` +