diff options
author | ache <ache@ache.one> | 2018-02-07 12:49:02 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2018-02-07 12:49:02 +0100 |
commit | 4351d11e4177308e01fe0e6cc1860e315ae9843e (patch) | |
tree | a58a3691199ac61550a55fe3a3209e49a276c691 /app.js | |
parent | Add more tests (diff) |
Validate some tests
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -1,12 +1,11 @@ const visit = require('unist-util-visit'); -let nbMC = 0; - function dealLabelChildren(listChild) { let t = []; if (listChild[0].type === 'paragraph') { t = listChild[0].children; } + t[0].value = t[0].value.trim(); if (listChild[listChild.length - 1].type === 'blockquote') { listChild[listChild.length - 1].type = 'div'; listChild[listChild.length - 1].data = { @@ -21,6 +20,7 @@ function dealLabelChildren(listChild) { } function visitList(ast) { + let nbMC = 0; return visit(ast, 'list', node => { let isMultipleChoise = true; let nbQ = 0; @@ -64,16 +64,10 @@ function visitList(ast) { type: 'list-item-mc', data: { hName: 'ul', - hProperties: { - style: 'list-style-type: none', - }, }, children: node.children.map(x => ({type: 'input-list-item', data: { hName: 'li', - hProperties: { - style: 'list-style-type: none', - }, }, children: [ {type: 'input-list-input', @@ -83,7 +77,7 @@ function visitList(ast) { checked: x.checked, type: 'checkbox', id: `mc_${nbMC}_${nbQ}`, - className: '!=~'[tab[nbQ]], + className: '!~='[tab[nbQ] * 2], }, }}, { @@ -97,7 +91,9 @@ function visitList(ast) { children: dealLabelChildren(x.children), }], })), - }, {type: 'field-button', + }, + { + type: 'field-button', data: { hName: 'input', hProperties: { @@ -106,7 +102,6 @@ function visitList(ast) { type: 'button', }, }, - }, ]; |