aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-02-07 04:50:23 +0100
committerache <ache@ache.one>2018-02-07 04:50:23 +0100
commitf7f258b33a583d645e65aa37f386d217c2ebe4fd (patch)
treefbca797c6b29c5d3063b7d245e42ef42bd15df32
parentMake the tests (diff)
Pass every test
-rw-r--r--__tests__/index.js2
-rw-r--r--app.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/__tests__/index.js b/__tests__/index.js
index ad27736..1d54f2a 100644
--- a/__tests__/index.js
+++ b/__tests__/index.js
@@ -66,7 +66,7 @@ test('line-input-classes', t => {
test('line-input-key-value', t => {
const {contents} = render('[__here__]{unicorn="horse + horn"}');
- t.is(contents, '<p><input unicorn="horse + horn" type="text" placeholder="here"></p>');
+ t.is(contents, '<p><input type="text" unicorn="horse + horn" placeholder="here"></p>');
});
test('line-input-overwrite-type', t => {
diff --git a/app.js b/app.js
index 5b4ec1b..f0f10f2 100644
--- a/app.js
+++ b/app.js
@@ -31,7 +31,7 @@ function parseHTMLparam(value, indexNext) {
return eaten;
};
- const prop = {key: undefined /* {} */, class: undefined /* [] */, id: undefined};
+ const prop = {key: undefined /* {} */, class: undefined /* [] */, id: undefined, type: 'text'};
let type;
while (value.charAt(indexNext) !== '}') {
@@ -89,7 +89,7 @@ function parseHTMLparam(value, indexNext) {
}
switch (type) {
case 'id': // ID
- prop.id = labelFirst;
+ prop.id = prop.id || labelFirst;
break;
case 'class':
if (!prop.class) {