markdown-it-task-checkbox
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "markdown-it-task-checkbox", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A markdown-it plugin to create GitHub-style task lists", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"author": "linsir", | ||
"license": "MIT", | ||
"license": "ISC", | ||
"bugs": { | ||
@@ -40,0 +40,0 @@ "url": "https://github.com/linsir/markdown-it-task-checkbox/issues" |
@@ -5,3 +5,3 @@ # markdown-it-task-lists | ||
Modify from <https://github.com/mcecot/markdown-it-checkbox> and <https://github.com/revin/markdown-it-task-lists> | ||
Modified from <https://github.com/mcecot/markdown-it-checkbox> and <https://github.com/revin/markdown-it-task-lists> | ||
@@ -13,7 +13,6 @@ | ||
node.js, browser: | ||
node.js: | ||
```bash | ||
npm install markdown-it-task-checkbox --save | ||
bower install markdown-it-task-checkbox --save | ||
``` | ||
@@ -99,2 +98,2 @@ | ||
MIT License © 2016 Linsir | ||
MIT License © 2016 Linsir |
@@ -41,3 +41,3 @@ /* globals before, describe, it */ | ||
var shouldBeUnchecked = (fixtures.ordered.match(/[\.\*\+-]\s+\[ \]/g) || []).length; | ||
assert.equal(shouldBeUnchecked, $.ordered('input[type=checkbox].task-list-item-checkbox:not(:checked)').length); | ||
assert.equal($.ordered('input[type=checkbox]:not(:checked)').length, shouldBeUnchecked); | ||
}); | ||
@@ -47,3 +47,3 @@ | ||
var shouldBeChecked = (fixtures.ordered.match(/[\.\*\+-]\s+\[[Xx]\]/g) || []).length; | ||
assert.equal(shouldBeChecked, $.ordered('input[type=checkbox].task-list-item-checkbox:checked').length); | ||
assert.equal(shouldBeChecked, $.ordered('input[type=checkbox]:checked').length); | ||
}); | ||
@@ -55,34 +55,15 @@ | ||
it('enables the rendered checkboxes when options.enabled is truthy', function () { | ||
var enabledParser = md().use(taskLists, {enabled: true}); | ||
it('enables the rendered checkboxes when options.disabled is falsy', function () { | ||
var enabledParser = md().use(taskLists, {disabled: false}); | ||
var $$ = cheerio.load(enabledParser.render(fixtures.ordered)); | ||
assert($$('input[type=checkbox].task-list-item-checkbox:not([disabled])').length > 0); | ||
assert($$('input[type=checkbox]:not([disabled])').length > 0); | ||
}); | ||
it('skips rendering wrapping <label> elements', function () { | ||
assert.equal(0, $.bullet('label').length); | ||
assert.equal(0, $.ordered('label').length); | ||
assert.equal(0, $.mixedNested('label').length); | ||
assert.equal(0, $.dirty('label').length); | ||
}); | ||
it('does not render wrapping <label> elements when options.label is falsy', function () { | ||
var unlabeledParser = md().use(taskLists, {label: false}); | ||
var $$ = cheerio.load(unlabeledParser.render(fixtures.ordered)); | ||
assert.equal(0, $$('label').length); | ||
}); | ||
it("wraps the rendered list items' contents in a <label> element when options.label is truthy", function () { | ||
var labeledParser = md().use(taskLists, {label: true}); | ||
it("gives the rendered list items a <label> element", function () { | ||
var labeledParser = md().use(taskLists); | ||
var $$ = cheerio.load(labeledParser.render(fixtures.ordered)); | ||
assert($$('.task-list-item > label > input[type=checkbox].task-list-item-checkbox').length > 0); | ||
assert($$('.task-list-item > label').length > 0); | ||
}); | ||
it('wraps and enables items when options.enabled and options.label are truthy', function () { | ||
var enabledLabeledParser = md().use(taskLists, {enabled: true, label: true}); | ||
var $$ = cheerio.load(enabledLabeledParser.render(fixtures.ordered)); | ||
assert($$('.task-list-item > label > input[type=checkbox].task-list-item-checkbox:not([disabled])').length > 0); | ||
}); | ||
it.only('does NOT render [ ], "[ ]" (no space after closing bracket), [ x], [x ], or [ x ] as checkboxes', function () { | ||
it('does NOT render [ ], "[ ]" (no space after closing bracket), [ x], [x ], or [ x ] as checkboxes', function () { | ||
var html = $.dirty.html(); | ||
@@ -89,0 +70,0 @@ assert(~html.indexOf('<li>[ ]')); |
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
75139
11
176