add checkboxes

This commit is contained in:
tristan 2024-01-01 20:27:05 +00:00
parent c29ff7b22e
commit 4f28cbfda7
5 changed files with 60 additions and 35 deletions

View file

@ -132,4 +132,9 @@ in with html; [
removeDunders = true;
}))
(it "renders on / off attrs" ({
actual = toString (tag "p" {on = true; off = false;});
expected = "<p on></p>";
}))
]

View file

@ -34,13 +34,12 @@ in with md; [
'';
expected = {
matched = true;
block = elems.List [''
something
''];
block = elems.List ["something"];
};
asJSON = true;
}))
(it "matches a list of many elements" ({
(it "makes a list of many elements" ({
actual = list ''
- something
- something else
@ -48,14 +47,28 @@ in with md; [
expected = {
matched = true;
block = elems.List [
''
something
''
''
something else
''
"something"
"something else"
];
};
asJSON = true;
}))
(it "makes a list of many checkboxes" ({
actual = list ''
- [ ] something
- [X] something else
'';
expected = {
matched = true;
block = elems.List [
[(elems.input {type = "checkbox"; disabled = true; checked = false; } "")
"something"]
[(elems.input {type = "checkbox"; disabled = true; checked = true; } "")
"something else"]
];
};
asJSON = true;
}))
(it "matches a list with no whitespace around" ({
@ -65,12 +78,11 @@ in with md; [
expected = {
matched = true;
block = elems.List [
''
something
''
"something"
"something else"
];
};
asJSON = true;
}))
(it "doesnt match not a list" (let str = "blah blah";
@ -82,15 +94,6 @@ in with md; [
};
}))
(it "makes a list" ({
actual = mdBlock ''
- something
'';
expected = elems.List [''
something
''];
}))
(it "finds surrounded parts" ({
actual = replace (wrap "\\*\\*") elems.strong ''
this text **may** contain **bold** words inside it.